]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: fix a compilation error if DEBUG is defined in btree_dirty_folio
authorQu Wenruo <wqu@suse.com>
Tue, 22 Aug 2023 05:50:51 +0000 (13:50 +0800)
committerDavid Sterba <dsterba@suse.com>
Fri, 8 Sep 2023 12:11:04 +0000 (14:11 +0200)
commit5e0e879926c1ce7e1f5e0dfaacaf2d105f7d8a05
tree532afbd4dee546074404e28b64149c87b3bdcf91
parent4ca8e03cf2bfaeef7c85939fa1ea0c749cd116ab
btrfs: fix a compilation error if DEBUG is defined in btree_dirty_folio

[BUG]
After commit 72a69cd03082 ("btrfs: subpage: pack all subpage bitmaps
into a larger bitmap"), the DEBUG section of btree_dirty_folio() would
no longer compile.

[CAUSE]
If DEBUG is defined, we would do extra checks for btree_dirty_folio(),
mostly to make sure the range we marked dirty has an extent buffer and
that extent buffer is dirty.

For subpage, we need to iterate through all the extent buffers covered
by that page range, and make sure they all matches the criteria.

However commit 72a69cd03082 ("btrfs: subpage: pack all subpage bitmaps
into a larger bitmap") changes how we store the bitmap, we pack all the
16 bits bitmaps into a larger bitmap, which would save some space.

This means we no longer have btrfs_subpage::dirty_bitmap, instead the
dirty bitmap is starting at btrfs_subpage_info::dirty_offset, and has a
length of btrfs_subpage_info::bitmap_nr_bits.

[FIX]
Although I'm not sure if it still makes sense to maintain such code, at
least let it compile.

This patch would let us test the bits one by one through the bitmaps.

CC: stable@vger.kernel.org # 6.1+
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c