Skip to content

Commit e4a82c1

Browse files
adam900710gregkh
authored andcommitted
btrfs: add comments on the extra btrfs specific subpage bitmaps
[ Upstream commit 1e17738 ] Unlike the iomap_folio_state structure, the btrfs_subpage structure has a lot of extra sub-bitmaps, namely: - writeback sub-bitmap - locked sub-bitmap iomap_folio_state uses an atomic for writeback tracking, while it has no per-block locked tracking. This is because iomap always locks a single folio, and submits dirty blocks with that folio locked. But btrfs has async delalloc ranges (for compression), which are queued with their range locked, until the compression is done, then marks the involved range writeback and unlocked. This means a range can be unlocked and marked writeback at seemingly random timing, thus it needs the extra tracking. This needs a huge rework on the lifespan of async delalloc range before we can remove/simplify these two sub-bitmaps. - ordered sub-bitmap - checked sub-bitmap These are for COW-fixup, but as I mentioned in the past, the COW-fixup is not really needed anymore and these two flags are already marked deprecated, and will be removed in the near future after comprehensive tests. Add related comments to indicate we're actively trying to align the sub-bitmaps to the iomap ones. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Stable-dep-of: b151136 ("btrfs: subpage: keep TOWRITE tag until folio is cleaned") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 10ec363 commit e4a82c1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

fs/btrfs/subpage.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,22 @@ enum {
3333
btrfs_bitmap_nr_uptodate = 0,
3434
btrfs_bitmap_nr_dirty,
3535
btrfs_bitmap_nr_writeback,
36+
/*
37+
* The ordered and checked flags are for COW fixup, already marked
38+
* deprecated, and will be removed eventually.
39+
*/
3640
btrfs_bitmap_nr_ordered,
3741
btrfs_bitmap_nr_checked,
42+
43+
/*
44+
* The locked bit is for async delalloc range (compression), currently
45+
* async extent is queued with the range locked, until the compression
46+
* is done.
47+
* So an async extent can unlock the range at any random timing.
48+
*
49+
* This will need a rework on the async extent lifespan (mark writeback
50+
* and do compression) before deprecating this flag.
51+
*/
3852
btrfs_bitmap_nr_locked,
3953
btrfs_bitmap_nr_max
4054
};

0 commit comments

Comments
 (0)