Re: [PATCH v2 24/24] ext4: enable block size larger than page size

From: Baokun Li
Date: Mon Nov 10 2025 - 22:43:24 EST


On 2025-11-10 23:16, Theodore Ts'o wrote:
> On Fri, Nov 07, 2025 at 10:42:49PM +0800, libaokun@xxxxxxxxxxxxxxx wrote:
>> From: Baokun Li <libaokun1@xxxxxxxxxx>
>>
>> Since block device (See commit 3c20917120ce ("block/bdev: enable large
>> folio support for large logical block sizes")) and page cache (See commit
>> ab95d23bab220ef8 ("filemap: allocate mapping_min_order folios in the page
>> cache")) has the ability to have a minimum order when allocating folio,
>> and ext4 has supported large folio in commit 7ac67301e82f ("ext4: enable
>> large folio for regular file"), now add support for block_size > PAGE_SIZE
>> in ext4.
>>
>> set_blocksize() -> bdev_validate_blocksize() already validates the block
>> size, so ext4_load_super() does not need to perform additional checks.
>>
>> Here we only need to add the FS_LBS bit to fs_flags.
>>
>> In addition, allocation failures for large folios may trigger warn_alloc()
>> warnings. Therefore, as with XFS, mark this feature as experimental.
>>
>> Signed-off-by: Baokun Li <libaokun1@xxxxxxxxxx>
>> Reviewed-by: Zhang Yi <yi.zhang@xxxxxxxxxx>
> Could you add:
>
> #ifdef CONFIG_TRANSPARENT_HUGEPAGES
> EXT4_ATTR_FEATURE(blocksize_gt_pagesize);
> #endif
>
> in fs/sys/sysfs.c, so that userspace programs (like those in e2fsprogs
> and xfstests) can test /sys/fs/ext4/features/... to determine whether
> or not blocksize > pagesize is supported? That way we can more easily
> determine whether to test the 64k blocksize configurations in
> xfstests, and so we can supress the mke2fs warnings:
>
> mke2fs: 65536-byte blocks too big for system (max 4096)
> Proceed anyway? (y,N) y
> Warning: 65536-byte blocks too big for system (max 4096), forced to continue
>
> ... if the feature flag file is present.
>
Good idea — sure!

In my earlier tests I just dropped the warning in mke2fs. That’s a bit
clumsy though; adding an interface so mke2fs and the kernel can work
together is much nicer.

It also lets us do what was mentioned in another thread: warn in mke2fs
instead of in the kernel. I’ll take your suggestion in the next version
and drop the experimental tag.

Thank you for your suggestion!


Regards,
Baokun