[PATCH] f2fs: expose subpage_block feature via sysfs

From: Daeho Jeong

Date: Wed Dec 02 2026 - 16:45:47 EST


From: Daeho Jeong <daehojeong@xxxxxxxxxx>

f2fs can mount a filesystem whose block size is smaller than the page
size, down to 4KB. A kernel without this support rejects such a
filesystem at mount time, and userspace has no way to tell the two
apart. A tool that formats a device needs to know it before picking the
block size, e.g. to choose between 4KB and 16KB blocks on a 16KB page
kernel.

Add /sys/fs/f2fs/features/subpage_block, so that userspace can check
whether the running kernel supports a block size smaller than the page
size.

Signed-off-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
---
Documentation/ABI/testing/sysfs-fs-f2fs | 2 +-
fs/f2fs/sysfs.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index e7e968c6df92..33948ebc560c 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -271,7 +271,7 @@ Description: Shows all enabled kernel features.
inode_crtime, lost_found, verity, sb_checksum,
casefold, readonly, compression, test_dummy_encryption_v2,
atomic_write, pin_file, encrypted_casefold, linear_lookup,
- fserror, metadata_cache, resizable_tail.
+ fserror, metadata_cache, resizable_tail, subpage_block.

What: /sys/fs/f2fs/<disk>/inject_rate
Date: May 2016
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 430356e500af..1325985e8df7 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -1428,6 +1428,7 @@ F2FS_FEATURE_RO_ATTR(packed_ssa);
F2FS_FEATURE_RO_ATTR(fserror);
F2FS_FEATURE_RO_ATTR(metadata_cache);
F2FS_FEATURE_RO_ATTR(resizable_tail);
+F2FS_FEATURE_RO_ATTR(subpage_block);

#define ATTR_LIST(name) (&f2fs_attr_##name.attr)
static struct attribute *f2fs_attrs[] = {
@@ -1604,6 +1605,7 @@ static struct attribute *f2fs_feat_attrs[] = {
BASE_ATTR_LIST(fserror),
BASE_ATTR_LIST(metadata_cache),
BASE_ATTR_LIST(resizable_tail),
+ BASE_ATTR_LIST(subpage_block),
NULL,
};
ATTRIBUTE_GROUPS(f2fs_feat);
--
2.56.1.915.g69d5ec7298-goog