linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, cen zhang <zzzccc427@gmail.com>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: remove XFS_IBULK_SAME_AG
Date: Wed, 23 Jul 2025 09:21:23 -0700	[thread overview]
Message-ID: <20250723162123.GY2672049@frogsfrogsfrogs> (raw)
In-Reply-To: <20250723122011.3178474-3-hch@lst.de>

On Wed, Jul 23, 2025 at 02:19:45PM +0200, Christoph Hellwig wrote:
> Add a new field to struct xfs_ibulk to directly pass XFS_IWALK* flags,
> and thus remove the need to indirect the SAME_AG flag through
> XFS_IBULK*.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Yeah, that clears things up :)
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_ioctl.c  |  2 +-
>  fs/xfs/xfs_itable.c | 12 ++----------
>  fs/xfs/xfs_itable.h | 10 ++++------
>  3 files changed, 7 insertions(+), 17 deletions(-)
> 
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index fe1f74a3b6a3..e1051a530a50 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -219,7 +219,7 @@ xfs_bulk_ireq_setup(
>  		else if (XFS_INO_TO_AGNO(mp, breq->startino) < hdr->agno)
>  			return -EINVAL;
>  
> -		breq->flags |= XFS_IBULK_SAME_AG;
> +		breq->iwalk_flags |= XFS_IWALK_SAME_AG;
>  
>  		/* Asking for an inode past the end of the AG?  We're done! */
>  		if (XFS_INO_TO_AGNO(mp, breq->startino) > hdr->agno)
> diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
> index 5116842420b2..2aa37a4d2706 100644
> --- a/fs/xfs/xfs_itable.c
> +++ b/fs/xfs/xfs_itable.c
> @@ -307,7 +307,6 @@ xfs_bulkstat(
>  		.breq		= breq,
>  	};
>  	struct xfs_trans	*tp;
> -	unsigned int		iwalk_flags = 0;
>  	int			error;
>  
>  	if (breq->idmap != &nop_mnt_idmap) {
> @@ -328,10 +327,7 @@ xfs_bulkstat(
>  	 * locking abilities to detect cycles in the inobt without deadlocking.
>  	 */
>  	tp = xfs_trans_alloc_empty(breq->mp);
> -	if (breq->flags & XFS_IBULK_SAME_AG)
> -		iwalk_flags |= XFS_IWALK_SAME_AG;
> -
> -	error = xfs_iwalk(breq->mp, tp, breq->startino, iwalk_flags,
> +	error = xfs_iwalk(breq->mp, tp, breq->startino, breq->iwalk_flags,
>  			xfs_bulkstat_iwalk, breq->icount, &bc);
>  	xfs_trans_cancel(tp);
>  	kfree(bc.buf);
> @@ -447,21 +443,17 @@ xfs_inumbers(
>  		.breq		= breq,
>  	};
>  	struct xfs_trans	*tp;
> -	unsigned int		iwalk_flags = 0;
>  	int			error = 0;
>  
>  	if (xfs_bulkstat_already_done(breq->mp, breq->startino))
>  		return 0;
>  
> -	if (breq->flags & XFS_IBULK_SAME_AG)
> -		iwalk_flags |= XFS_IWALK_SAME_AG;
> -
>  	/*
>  	 * Grab an empty transaction so that we can use its recursive buffer
>  	 * locking abilities to detect cycles in the inobt without deadlocking.
>  	 */
>  	tp = xfs_trans_alloc_empty(breq->mp);
> -	error = xfs_inobt_walk(breq->mp, tp, breq->startino, iwalk_flags,
> +	error = xfs_inobt_walk(breq->mp, tp, breq->startino, breq->iwalk_flags,
>  			xfs_inumbers_walk, breq->icount, &ic);
>  	xfs_trans_cancel(tp);
>  
> diff --git a/fs/xfs/xfs_itable.h b/fs/xfs/xfs_itable.h
> index f10e8f8f2335..2d0612f14d6e 100644
> --- a/fs/xfs/xfs_itable.h
> +++ b/fs/xfs/xfs_itable.h
> @@ -13,17 +13,15 @@ struct xfs_ibulk {
>  	xfs_ino_t		startino; /* start with this inode */
>  	unsigned int		icount;   /* number of elements in ubuffer */
>  	unsigned int		ocount;   /* number of records returned */
> -	unsigned int		flags;    /* see XFS_IBULK_FLAG_* */
> +	unsigned int		flags;    /* XFS_IBULK_FLAG_* */
> +	unsigned int		iwalk_flags; /* XFS_IWALK_FLAG_* */
>  };
>  
> -/* Only iterate within the same AG as startino */
> -#define XFS_IBULK_SAME_AG	(1U << 0)
> -
>  /* Fill out the bs_extents64 field if set. */
> -#define XFS_IBULK_NREXT64	(1U << 1)
> +#define XFS_IBULK_NREXT64	(1U << 0)
>  
>  /* Signal that we can return metadata directories. */
> -#define XFS_IBULK_METADIR	(1U << 2)
> +#define XFS_IBULK_METADIR	(1U << 1)
>  
>  /*
>   * Advance the user buffer pointer by one record of the given size.  If the
> -- 
> 2.47.2
> 
> 

  reply	other threads:[~2025-07-23 16:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-23 12:19 fix XFS_IBULK_* vs XFS_IWALK_* confusion Christoph Hellwig
2025-07-23 12:19 ` [PATCH 1/2] xfs: fully decouple XFS_IBULK* flags from XFS_IWALK* flags Christoph Hellwig
2025-07-23 16:20   ` Darrick J. Wong
2025-08-05  9:23     ` Carlos Maiolino
2025-07-23 12:19 ` [PATCH 2/2] xfs: remove XFS_IBULK_SAME_AG Christoph Hellwig
2025-07-23 16:21   ` Darrick J. Wong [this message]
2025-08-12  7:33 ` fix XFS_IBULK_* vs XFS_IWALK_* confusion Carlos Maiolino

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=20250723162123.GY2672049@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zzzccc427@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).