On 4/15/21 1:04 AM, Qu Wenruo wrote:
Introduce a new data inodes specific subpage member, writers, to record
how many sectors are under page lock for delalloc writing.

This member acts pretty much the same as readers, except it's only for
delalloc writes.

This is important for delalloc code to trace which page can really be
freed, as we have cases like run_delalloc_nocow() where we may exit
processing nocow range inside a page, but need to exit to do cow half
way.
In that case, we need a way to determine if we can really unlock a full
page.

With the new btrfs_subpage::writers, there is a new requirement:
- Page locked by process_one_page() must be unlocked by
   process_one_page()
   There are still tons of call sites manually lock and unlock a page,
   without updating btrfs_subpage::writers.
   So if we lock a page through process_one_page() then it must be
   unlocked by process_one_page() to keep btrfs_subpage::writers
   consistent.

   This will be handled in next patch.

Signed-off-by: Qu Wenruo <w...@suse.com>

Reviewed-by: Josef Bacik <jo...@toxicpanda.com>

Thanks,

Josef

Reply via email to