Skip to content

Commit 8611e60

Browse files
LiBaokun96tytso
authored andcommitted
ext4: introduce s_min_folio_order for future BS > PS support
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>
1 parent 5829741 commit 8611e60

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

fs/ext4/ext4.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,6 +1697,9 @@ struct ext4_sb_info {
16971697
/* record the last minlen when FITRIM is called. */
16981698
unsigned long s_last_trim_minblks;
16991699

1700+
/* minimum folio order of a page cache allocation */
1701+
unsigned int s_min_folio_order;
1702+
17001703
/* Precomputed FS UUID checksum for seeding other checksums */
17011704
__u32 s_csum_seed;
17021705

fs/ext4/inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5183,7 +5183,8 @@ void ext4_set_inode_mapping_order(struct inode *inode)
51835183
if (!ext4_should_enable_large_folio(inode))
51845184
return;
51855185

5186-
mapping_set_folio_order_range(inode->i_mapping, 0,
5186+
mapping_set_folio_order_range(inode->i_mapping,
5187+
EXT4_SB(inode->i_sb)->s_min_folio_order,
51875188
EXT4_MAX_PAGECACHE_ORDER(inode));
51885189
}
51895190

fs/ext4/super.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5109,11 +5109,8 @@ static int ext4_load_super(struct super_block *sb, ext4_fsblk_t *lsb,
51095109
* If the default block size is not the same as the real block size,
51105110
* we need to reload it.
51115111
*/
5112-
if (sb->s_blocksize == blocksize) {
5113-
*lsb = logical_sb_block;
5114-
sbi->s_sbh = bh;
5115-
return 0;
5116-
}
5112+
if (sb->s_blocksize == blocksize)
5113+
goto success;
51175114

51185115
/*
51195116
* 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,
51445141
ext4_msg(sb, KERN_ERR, "Magic mismatch, very weird!");
51455142
goto out;
51465143
}
5144+
5145+
success:
5146+
sbi->s_min_folio_order = get_order(blocksize);
51475147
*lsb = logical_sb_block;
51485148
sbi->s_sbh = bh;
51495149
return 0;

0 commit comments

Comments
 (0)