[PATCH 0/2] btrfs-progs: allowing 2K block size for experimental builds

Qu Wenruo
2025-02-26T03:59:41Z

Btrfs always has its minimal block size as 4K, but that means on the
most common architecture, x86_64, we can not utilize the subpage block
size routine at all.

Although the future larger folios support will allow us to utilize
subpage routines, the support is still not yet there.

On the other hand, lowering the block size for experimental/debug builds is
much easier, there is only one major bug (fixed by the first patch) in
btrfs-progs at least.

Kernel sides enablement is not huge either, but it has dependency on
the subpage related backlog patches to pass most fstests, which is not small.

However since we're not pushing this 2K block size for end users, we can
accept some limitations on the 2K block size support:

- No 2K node size mkfs support
This is mostly caused by how we create the initial temporaray fs.
The initial temporaray fs contains at least 6 root items.
But one root item is 439 bytes, we need a level 1 root tree for the
initial temporaray fs.

But we do not support multi-level trees for the initial fs, thus no
such support for now.

- No mixed block groups mkfs support
Caused by the missing 2K node size support

Qu Wenruo (3):
btrfs-progs: fix the incorrect buffer size for super block
btrfs-progs: support 2k block size
btrfs-progs: convert: check the sectorsize against BTRFS_MIN_BLOCKSIZE

common/device-scan.c | 2 +-
common/fsfeatures.c | 11 ++++++++---
convert/main.c | 2 +-
kernel-shared/ctree.h | 6 ++++++
kernel-shared/disk-io.c | 11 ++++-------
mkfs/main.c | 7 -------
6 files changed, 20 insertions(+), 19 deletions(-)

--
2.48.1