[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tai2z6hjykb26rqhtql3wd6fg23747wdioliyzqmtq2s432ii6@euiky43uwohz>
Date: Thu, 15 Jan 2026 11:59:52 +0000
From: Pedro Falcato <pfalcato@...e.de>
To: Jan Kara <jack@...e.cz>
Cc: Ted Tso <tytso@....edu>, linux-ext4@...r.kernel.org,
Baokun Li <libaokun1@...wei.com>, Zhang Yi <yi.zhang@...wei.com>
Subject: Re: [PATCH 1/2] ext4: always allocate blocks only from groups inode
can use
On Wed, Jan 14, 2026 at 07:28:18PM +0100, Jan Kara wrote:
> For filesystems with more than 2^32 blocks inodes using indirect block
> based format cannot use blocks beyond the 32-bit limit.
> ext4_mb_scan_groups_linear() takes care to not select these unsupported
> groups for such inodes however other functions selecting groups for
> allocation don't. So far this is harmless because the other selection
> functions are used only with mb_optimize_scan and this is currently
> disabled for inodes with indirect blocks however in the following patch
> we want to enable mb_optimize_scan regardless of inode format.
>
> Reviewed-by: Baokun Li <libaokun1@...wei.com>
> Reviewed-by: Zhang Yi <yi.zhang@...wei.com>
> Signed-off-by: Jan Kara <jack@...e.cz>
Acked-by: Pedro Falcato <pfalcato@...e.de>
Thanks for addressing my nit :)
> ---
> fs/ext4/mballoc.c | 29 ++++++++++++++++++++---------
> 1 file changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 56d50fd3310b..a88fbaa4f5f4 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -892,6 +892,21 @@ mb_update_avg_fragment_size(struct super_block *sb, struct ext4_group_info *grp)
> }
> }
>
> +static ext4_group_t ext4_get_allocation_groups_count(
> + struct ext4_allocation_context *ac)
> +{
> + ext4_group_t ngroups = ext4_get_groups_count(ac->ac_sb);
> +
> + /* non-extent files are limited to low blocks/groups */
> + if (!(ext4_test_inode_flag(ac->ac_inode, EXT4_INODE_EXTENTS)))
> + ngroups = EXT4_SB(ac->ac_sb)->s_blockfile_groups;
> +
> + /* Pairs with smp_wmb() in ext4_update_super() */
> + smp_rmb();
> +
> + return ngroups;
> +}
For what it's worth now we get 2 smp_rmb()'s (get_groups_count() has one),
but I suppose this can be fixed up later. Probably doesn't make sense to
withold these patches further.
--
Pedro
Powered by blists - more mailing lists