]> Gentwo Git Trees - linux/.git/commitdiff
ext4: introduce s_min_folio_order for future BS > PS support
authorBaokun Li <libaokun1@huawei.com>
Fri, 21 Nov 2025 09:06:36 +0000 (17:06 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 29 Nov 2025 03:35:26 +0000 (22:35 -0500)
This commit introduces the s_min_folio_order field to the ext4_sb_info
structure. This field will store the minimum folio order required by the
current filesystem, laying groundwork for future support of block sizes
greater than PAGE_SIZE.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Pankaj Raghav <p.raghav@samsung.com>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Message-ID: <20251121090654.631996-7-libaokun@huaweicloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/inode.c
fs/ext4/super.c

index 6c2540e94c78a9993ab3d316097b7b6738970249..0502afa6f6e5bea9b72c4efc30e58fc5168bc267 100644 (file)
@@ -1697,6 +1697,9 @@ struct ext4_sb_info {
        /* record the last minlen when FITRIM is called. */
        unsigned long s_last_trim_minblks;
 
+       /* minimum folio order of a page cache allocation */
+       unsigned int s_min_folio_order;
+
        /* Precomputed FS UUID checksum for seeding other checksums */
        __u32 s_csum_seed;
 
index 5cf392142c8ca26a59a662320ffc02a9720268e9..ff697adab5f65a92df753aab71fa344ceed99cf1 100644 (file)
@@ -5183,7 +5183,8 @@ void ext4_set_inode_mapping_order(struct inode *inode)
        if (!ext4_should_enable_large_folio(inode))
                return;
 
-       mapping_set_folio_order_range(inode->i_mapping, 0,
+       mapping_set_folio_order_range(inode->i_mapping,
+                                     EXT4_SB(inode->i_sb)->s_min_folio_order,
                                      EXT4_MAX_PAGECACHE_ORDER(inode));
 }
 
index f39679892e71324a9ba47803fe67e6fdd536dec8..2286cd1e3cb83472789a889ae733e6e61578a0fd 100644 (file)
@@ -5109,11 +5109,8 @@ static int ext4_load_super(struct super_block *sb, ext4_fsblk_t *lsb,
         * If the default block size is not the same as the real block size,
         * we need to reload it.
         */
-       if (sb->s_blocksize == blocksize) {
-               *lsb = logical_sb_block;
-               sbi->s_sbh = bh;
-               return 0;
-       }
+       if (sb->s_blocksize == blocksize)
+               goto success;
 
        /*
         * bh must be released before kill_bdev(), otherwise
@@ -5144,6 +5141,9 @@ static int ext4_load_super(struct super_block *sb, ext4_fsblk_t *lsb,
                ext4_msg(sb, KERN_ERR, "Magic mismatch, very weird!");
                goto out;
        }
+
+success:
+       sbi->s_min_folio_order = get_order(blocksize);
        *lsb = logical_sb_block;
        sbi->s_sbh = bh;
        return 0;