Re: [PATCH v2 3/4] btrfs: introduce btrfs_subpage_bitmap_info
From: Nikolay Borisov <hidden>
Date: 2021-08-17 10:11:47
On 17.08.21 г. 12:38, Qu Wenruo wrote:
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 towards such compact bitmap. Signed-off-by: Qu Wenruo <redacted> --- fs/btrfs/ctree.h | 1 + fs/btrfs/disk-io.c | 12 +++++++++--- fs/btrfs/subpage.c | 35 +++++++++++++++++++++++++++++++++++ fs/btrfs/subpage.h | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 3 deletions(-)
<snip>
+/* + * Extra info for subpapge bitmap. + * + * For subpage we pack all uptodate/error/dirty/writeback/ordered + * bitmaps into one larger bitmap. + * + * This structure records how they are organized in such bitmap: + * + * /- uptodate_offset /- error_offset /- dirty_offset + * | | | + * v v v + * |u|u|u|u|........|u|u|e|e|.......|e|e| ... |o|o|
nit: the 'e' that the dirty offset is pointing to should be a 'd', I'm sure David can fix this while merging. <snip>