Re: [PATCH v2 1/3] xfs: set minleft correctly for sparse chunk errortag allocation

"Darrick J. Wong" <[email protected]>
Newsgroups org.kernel.vger.linux-xfs
Message-ID <20260814185428.GJ3556460@frogsfrogsfrogs>
On Fri, Aug 14, 2026 at 09:22:37AM -0400, Brian Foster wrote:
> The errortag instrumentation for forced sparse chunk allocation
> jumps straight to the allocation path without setting args.minleft.
> minleft is unconditionally set to ->inobt_maxlevels for the normal
> allocation path. Lift the assignment to the initial args setup so
> it covers all possible paths.
> 
> Assisted-by: LLM
> Fixes: 1cdadee11f8d ("xfs: randomly do sparse inode allocations in DEBUG mode")
> Signed-off-by: Brian Foster <[email protected]>
> Reviewed-by: Mark Tinguely <[email protected]>

This makes sense to me;
Reviewed-by: "Darrick J. Wong" <[email protected]>

--D

> ---
>  fs/xfs/libxfs/xfs_ialloc.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index ffcdd1f691fd..633b2d6e42c5 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -733,6 +733,10 @@ xfs_ialloc_ag_alloc(
>  							igeo->maxicount)
>  		return -ENOSPC;
>  	args.minlen = args.maxlen = igeo->ialloc_blks;
> +
> +	/* Allow space for the inode btree to split. */
> +	args.minleft = igeo->inobt_maxlevels;
> +
>  	/*
>  	 * First try to allocate inodes contiguous with the last-allocated
>  	 * chunk of inodes.  If the filesystem is striped, this will fill
> @@ -764,8 +768,6 @@ xfs_ialloc_ag_alloc(
>  		args.alignment = 1;
>  		args.minalignslop = igeo->cluster_align - 1;
>  
> -		/* Allow space for the inode btree to split. */
> -		args.minleft = igeo->inobt_maxlevels;
>  		error = xfs_alloc_vextent_exact_bno(&args,
>  				xfs_agbno_to_fsb(pag, args.agbno));
>  		if (error)
> @@ -804,10 +806,6 @@ xfs_ialloc_ag_alloc(
>  		 * Allocate a fixed-size extent of inodes.
>  		 */
>  		args.prod = 1;
> -		/*
> -		 * Allow space for the inode btree to split.
> -		 */
> -		args.minleft = igeo->inobt_maxlevels;
>  		error = xfs_alloc_vextent_near_bno(&args,
>  				xfs_agbno_to_fsb(pag,
>  					be32_to_cpu(agi->agi_root)));
> -- 
> 2.55.0
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.