On 2020/1/23 下午9:49, Filipe Manana wrote: [...] >> This btrfs_wait_nocow_writers() is not just triggering ordered extents >> for nocow. >> It waits for the nocow_writers count decreased to 0 for that block group. >> >> Since we have already marked the block group RO, no new nocow writers >> can happen, thus that counter can only decrease, no way to increase. >> >> There are several cases involved: >> - NoCOW Write back happens before bg RO >> It will increase cache->nocow_writers counter, and decrease the >> counter after finish_oredered_io(). > > Nop. nocow_writers is decremented after creating the ordered extent > when starting writeback (at run_delalloc_nocow) - not when completing > the ordered extent (at btrfs_finish_ordered_io()). Oh, right. The dec part still happens in run_delalloc_nocow(). So the wait_ordered_roots() call is still needed. Thanks, Qu > Same applies direct IO. > > Thanks > >>> >> > >
Attachment:
signature.asc
Description: OpenPGP digital signature
