michallenc commented on PR #15812:
URL: https://github.com/apache/nuttx/pull/15812#issuecomment-2655780963

   @cederom @anchao @lupyuen @acassis Hey guys, I am not quite sure what's the 
problem here. The discussion was resolved, Alan just forgot to mark it, but he 
approved the PR after the changes, which should be sufficient.
   
   Regarding the possible blocking. I am aware it may be an issue under extreme 
circumstances, but write to the flash is currently ALWAYS blocking if you have 
to flush the buffer and erase page. We wait for QSPI transfer to finish, we 
wait for the erase to finish, there is a QSPI locking mechanism, so other 
thread accessing the flash may wait on the lock. BCH layer also has the lock. 
   
   Returning `-EBUSY` immediately is not good, you expect the `write` to wait 
if opened as blocking. And this errno even is not specified in POSIX for 
`write` call looking at the specification. As for the non-blocking access, the 
BCH/flash interface doesn't seem to handle it anyway, even without this change. 
   
   Yes, we can discuss some refactor to BCH, FTL, MTD layers to correctly 
handle non-blocking access, but I don't think this PR breaks something. The 
code won't enter the while loop in most of the cases, it is a fix for probably 
bad timing on some flashes. I experienced it on W25Q512, but not on W25Q01. And 
even on W25Q512 it's just one or two retries.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to