nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

FS: enhance file_allocate_from_tcb() mulit-threads saftey & remove memcpy when close the fd

Open GUIDINGLI opened this issue 1 year ago • 3 comments

Summary

FS: enhance file_allocate_from_tcb() mulit-threads saftey & remove memcpy when close the fd

Impact

FS

Testing

BES boards

GUIDINGLI avatar Mar 05 '24 04:03 GUIDINGLI

@GUIDINGLI I liked it removed two nested while()s with a single for() and it seems to simplify and improve performance. I'm afraid of the impacts, did you test using ostest and more extensive testing? Also since Tiago noticed the stack usage impact caused by #11777 could you confirm this modification will not increase code and/or stack usage too much?

acassis avatar Mar 05 '24 13:03 acassis

@GUIDINGLI please rebase your patch.

xiaoxiang781216 avatar Mar 06 '24 00:03 xiaoxiang781216

@GUIDINGLI I liked it removed two nested while()s with a single for() and it seems to simplify and improve performance. I'm afraid of the impacts, did you test using ostest and more extensive testing? Also since Tiago noticed the stack usage impact caused by #11777 could you confirm this modification will not increase code and/or stack usage too much?

@acassis The original code also has two nested while()s, and I don't think it will take more stack usage then the previous. And this PR's purpose is enhance the safety, because: file_allocate_from_tcb() hasn't fully protected by spin_lock_irqsave().

GUIDINGLI avatar Mar 06 '24 15:03 GUIDINGLI