All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] xfs: restore old agirotor behavior
Date: Mon, 27 Feb 2023 09:02:01 +1100	[thread overview]
Message-ID: <20230226220201.GT360264@dread.disaster.area> (raw)
In-Reply-To: <Y/WoHLYbp82Xj7H8@magnolia>

On Tue, Feb 21, 2023 at 09:29:00PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Prior to the removal of xfs_ialloc_next_ag, we would increment the agi
> rotor and return the *old* value.  atomic_inc_return returns the new
> value, which causes mkfs to allocate the root directory in AG 1.  Put
> back the old behavior (at least for mkfs) by subtracting 1 here.
> 
> Fixes: 20a5eab49d35 ("xfs: convert xfs_ialloc_next_ag() to an atomic")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/xfs/libxfs/xfs_ialloc.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index 65832c74e86c..550c6351e9b6 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -1729,7 +1729,7 @@ xfs_dialloc(
>  	 * an AG has enough space for file creation.
>  	 */
>  	if (S_ISDIR(mode))
> -		start_agno = atomic_inc_return(&mp->m_agirotor) % mp->m_maxagi;
> +		start_agno = (atomic_inc_return(&mp->m_agirotor) - 1) % mp->m_maxagi;
>  	else {
>  		start_agno = XFS_INO_TO_AGNO(mp, parent);
>  		if (start_agno >= mp->m_maxagi)

Change is fine, but it pushes the code to 85 columns. If you clean
it up to:

	if (S_ISDIR(mode)) {
		start_agno = (atomic_inc_return(&mp->m_agirotor) - 1) %
				mp->m_maxagi;
	} else {
		....

Then you can add:

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2023-02-26 22:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22  5:29 [PATCH] xfs: restore old agirotor behavior Darrick J. Wong
2023-02-26 22:02 ` Dave Chinner [this message]
2023-02-27 17:09   ` Darrick J. Wong

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=20230226220201.GT360264@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --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.