On Wed, Mar 20, 2019 at 02:27:46PM +0800, Qu Wenruo wrote: > This function needs some extra check on locked pages and eb. > > For error handling we need to unlock locked pages and the eb. > > Also add comment for possible return values of lock_extent_buffer_for_io(). > > There is a rare >0 return value branch, where all pages get locked > while write bio is not flushed. > > Thankfully it's handled by the only caller, btree_write_cache_pages(), > as later write_one_eb() call will trigger submit_one_bio(). > So there shouldn't be any problem.
Right, I'd suggest to add a comment to btree_write_cache_pages explaining that and possibly changing the condition to make it more explicit that all 3 types of values are really handled.