summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2026-06-19 18:24:47 +0930
committerDavid Sterba <dsterba@suse.com>2026-08-07 19:16:28 +0200
commit097cdc84620e7dbc8653bddb4a3009e08980ea1f (patch)
tree90f97f14eed0d565bed8d61befa26e145de5fa77
parent6eb2fe0724bd235f6f83d28c8f9c22666854bf2a (diff)
btrfs: allow any block size that is no larger than page size
Since v5.15 btrfs has support for block size < page size, but we still only support 4K block size, while there is no special reason that we cannot support 8K/16K/32K block sizes for 64K page size. That 4K limit is completely arbitrary, and mostly to reduce test runtime so we do not need to test all the extra block size combinations. However that also limits the user choices, some users may understand what they are doing, and want larger block sizes. In that case, fixed 4K block size for subpage routine is blocking our way. Just remove that fixed 4K requirement for block size < page size. This should not affect regular end users, since mkfs is already using 4K block size as default for quite a while, and the existing bs == ps support is always there. But for power users, this allows extra block size support, and may provide extra test coverage. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/fs.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/btrfs/fs.c b/fs/btrfs/fs.c
index 5bd6856213aa..de160d29dde8 100644
--- a/fs/btrfs/fs.c
+++ b/fs/btrfs/fs.c
@@ -127,14 +127,9 @@ void btrfs_csum_final(struct btrfs_csum_ctx *ctx, u8 *out)
}
/*
- * We support the following block sizes for all systems:
- *
- * - 4K
- * This is the most common block size. For PAGE SIZE > 4K cases the subpage
- * mode is used.
- *
- * - PAGE_SIZE
- * The straightforward block size to support.
+ * For regular builds, any block size <= page size is supported.
+ * For experimental builds, any block size between BTRFS_MIN_BLOCKSIZE
+ * and BTRFS_MAX_BLOCKSIZE (inclusive) is supported.
*/
bool __attribute_const__ btrfs_supported_blocksize(u32 blocksize)
{
@@ -142,7 +137,7 @@ bool __attribute_const__ btrfs_supported_blocksize(u32 blocksize)
ASSERT(is_power_of_2(blocksize) && blocksize >= BTRFS_MIN_BLOCKSIZE &&
blocksize <= BTRFS_MAX_BLOCKSIZE);
- if (blocksize == PAGE_SIZE || blocksize == SZ_4K || blocksize == BTRFS_MIN_BLOCKSIZE)
+ if (blocksize <= PAGE_SIZE)
return true;
#ifdef CONFIG_BTRFS_EXPERIMENTAL
/*