btrfs: subpage: do more sanity checks on metadata page dirtying
authorQu Wenruo <wqu@suse.com>
Thu, 25 Mar 2021 07:14:39 +0000 (15:14 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Apr 2021 15:25:18 +0000 (17:25 +0200)
commit139e8cd32592affac5a1e719c2be96ecb8405c19
tree8d5698e8962fbc62e36983adc0f1f9b73267078c
parent3470da3b7d87fde4b9729d4e29c2dc074cd59c10
btrfs: subpage: do more sanity checks on metadata page dirtying

For btree_set_page_dirty(), we should also check the extent buffer
sanity for subpage support.

Unlike the regular sector size case, since one page can contain multiple
extent buffers, we need to make sure there is at least one dirty extent
buffer in the page.

So this patch will iterate through the btrfs_subpage::dirty_bitmap
to get the extent buffers, and check if any dirty extent buffer in the page
range has EXTENT_BUFFER_DIRTY and proper refs.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c