btrfs: subpage: introduce btrfs_subpage_bitmap_info
authorQu Wenruo <wqu@suse.com>
Tue, 17 Aug 2021 09:38:51 +0000 (17:38 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Oct 2021 19:17:16 +0000 (21:17 +0200)
commit8481dd80ab1eccbe04334269d668b467e9dfa788
treecfbfad160a92a8768ca58a918e2ff7ba2a8fff37
parent651fb419273300ebad459630becd839d79439bbc
btrfs: subpage: introduce btrfs_subpage_bitmap_info

Currently we use fixed size u16 bitmap for subpage bitmap.  This is fine
for 4K sectorsize with 64K page size.

But for 4K sectorsize and larger page size, the bitmap is too small,
while for smaller page size like 16K, u16 bitmaps waste too much space.

Here we introduce a new helper structure, btrfs_subpage_bitmap_info, to
record the proper bitmap size, and where each bitmap should start at.

By this, we can later compact all subpage bitmaps into one u32 bitmap.
This patch is the first step.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
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/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/subpage.c
fs/btrfs/subpage.h