All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Tinguely <mark.tinguely@oracle.com>
To: Brian Foster <bfoster@redhat.com>, linux-xfs@vger.kernel.org
Subject: Re: [External] : [PATCH v3 2/4] xfs: support additional levels in the agfl minimum calculation
Date: Thu, 3 Sep 2026 11:58:32 -0500	[thread overview]
Message-ID: <24cc9708-11ac-41e2-94cd-170bb64f9f33@oracle.com> (raw)
In-Reply-To: <20260902174025.284387-3-bfoster@redhat.com>

On 9/2/26 12:40 PM, Brian Foster wrote:
> xfs_alloc_min_freelist() calculates the worst case AGFL block
> requirement for a full split plus partial refill for each alloc
> btree. An upcoming patch needs to calculate the requirement for
> multiple level increases, so add an optional extra levels parameter
> and factor out a wrapper function for the common case of a single
> split. No functional changes.
> 
> Assisted-by: LLM
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>


you can also add
Reviewed-by: Mark Tinguely <mark.tinguely@oracle.com>

> ---
>   fs/xfs/libxfs/xfs_alloc.c | 31 +++++++++++++++++++++++--------
>   1 file changed, 23 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index d99602bcc16f..dbb85fb6314b 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -2439,17 +2439,22 @@ xfs_alloc_longest_free_extent(
>   
>   /*
>    * Compute the minimum length of the AGFL in the given AG.  If @pag is NULL,
> - * return the largest possible minimum length.
> + * return the largest possible minimum length. The base calculation accounts
> + * for a single full split per btree. @extra_levels adds additional split
> + * levels to compute the prospective AGFL requirement increase for
> + * multi-allocation transactions.
>    */
> -unsigned int
> -xfs_alloc_min_freelist(
> +static unsigned int
> +__xfs_alloc_min_freelist(
>   	struct xfs_mount	*mp,
> -	struct xfs_perag	*pag)
> +	struct xfs_perag	*pag,
> +	unsigned int		extra_levels)
>   {
>   	/* AG btrees have at least 1 level. */
>   	const unsigned int	bno_level = pag ? pag->pagf_bno_level : 1;
>   	const unsigned int	cnt_level = pag ? pag->pagf_cnt_level : 1;
>   	const unsigned int	rmap_level = pag ? pag->pagf_rmap_level : 1;
> +	const unsigned int	levels = 1 + extra_levels;
>   	unsigned int		min_free;
>   
>   	ASSERT(mp->m_alloc_maxlevels > 0);
> @@ -2476,15 +2481,25 @@ xfs_alloc_min_freelist(
>   	 */
>   
>   	/* space needed by-bno freespace btree */
> -	min_free = min(bno_level + 1, mp->m_alloc_maxlevels) * 2 - 2;
> +	min_free = min(bno_level + levels, mp->m_alloc_maxlevels) * 2 - 2;
>   	/* space needed by-size freespace btree */
> -	min_free += min(cnt_level + 1, mp->m_alloc_maxlevels) * 2 - 2;
> +	min_free += min(cnt_level + levels, mp->m_alloc_maxlevels) * 2 - 2;
>   	/* space needed reverse mapping used space btree */
> -	if (xfs_has_rmapbt(mp))
> -		min_free += min(rmap_level + 1, mp->m_rmap_maxlevels) * 2 - 2;
> +	if (xfs_has_rmapbt(mp)) {
> +		min_free += min(rmap_level + levels,
> +				mp->m_rmap_maxlevels) * 2 - 2;
> +	}
>   	return min_free;
>   }
>   
> +unsigned int
> +xfs_alloc_min_freelist(
> +	struct xfs_mount	*mp,
> +	struct xfs_perag	*pag)
> +{
> +	return __xfs_alloc_min_freelist(mp, pag, 0);
> +}
> +
>   /*
>    * Check if the operation we are fixing up the freelist for should go ahead or
>    * not. If we are freeing blocks, we always allow it, otherwise the allocation


  reply	other threads:[~2026-09-03 16:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 17:40 [PATCH v3 0/4] xfs: fix a couple sparse chunk alloc problems Brian Foster
2026-09-02 17:40 ` [PATCH v3 1/4] xfs: set minleft correctly for sparse chunk errortag allocation Brian Foster
2026-09-02 17:40 ` [PATCH v3 2/4] xfs: support additional levels in the agfl minimum calculation Brian Foster
2026-09-03 16:58   ` Mark Tinguely [this message]
2026-09-02 17:40 ` [PATCH v3 3/4] xfs: calculate AGFL max to support multiple-alloc transactions Brian Foster
2026-09-04 13:55   ` [External] : " Mark Tinguely
2026-09-02 17:40 ` [PATCH v3 4/4] xfs: incorporate increased AGFL min requirement for minleft allocs Brian Foster
2026-09-04 14:00   ` [External] : " Mark Tinguely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24cc9708-11ac-41e2-94cd-170bb64f9f33@oracle.com \
    --to=mark.tinguely@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.