]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: allow debug builds to accept 2K block size
authorQu Wenruo <wqu@suse.com>
Tue, 25 Feb 2025 02:33:03 +0000 (13:03 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Mar 2025 19:35:49 +0000 (20:35 +0100)
commit306a75e647fe0ccb060d5098ee0829e418f01818
tree055db19207db07d9529c697897db01e82436270e
parent23019d3e6617a8ec99a8d2f5947aa3dd8a74a1b8
btrfs: allow debug builds to accept 2K block size

Currently we only support two block sizes, 4K and PAGE_SIZE.

This means on the most common architecture x86_64, we have no way to
test subpage block size.  And that's exactly I have an aarch64 machine
dedicated for subpage tests.

But this is still a hurdle for a lot of btrfs developers, and to improve
the test coverage mostly on x86_64, here we enable debug builds to
accept 2K block size.

This involves:

- Introduce a dedicated minimal block size macro
  BTRFS_MIN_BLOCKSIZE, which depends on if CONFIG_BTRFS_DEBUG is set.
  If so it's 2K, otherwise it's 4K as usual.

- Allow 4K, PAGE_SIZE and BTRFS_MIN_BLOCKSIZE as block size

- Update subpage block size checks to be based on BTRFS_MIN_BLOCKSIZE

- Export the new supported blocksize through sysfs interfaces

As most of the subpage support is already pretty mature, there is no
extra work needed to support the extra 2K block size.

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
fs/btrfs/fs.h
fs/btrfs/subpage.h
fs/btrfs/sysfs.c