Re: [PATCH V9 17/19] xfs: Decouple XFS_IBULK flags from XFS_IWALK flags

Darrick J. Wong
2022-04-07T01:32:02Z

On Wed, Apr 06, 2022 at 11:49:01AM +0530, Chandan Babu R wrote:
> A future commit will add a new XFS_IBULK flag which will not have a
> corresponding XFS_IWALK flag. In preparation for the change, this commit
> separates XFS_IBULK_* flags from XFS_IWALK_* flags.
>
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
> Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>

Looks good to me now,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
> fs/xfs/xfs_itable.c | 6 +++++-
> fs/xfs/xfs_itable.h | 2 +-
> fs/xfs/xfs_iwalk.h | 2 +-
> 3 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
> index c08c79d9e311..71ed4905f206 100644
> --- a/fs/xfs/xfs_itable.c
> +++ b/fs/xfs/xfs_itable.c
> @@ -256,6 +256,7 @@ xfs_bulkstat(
> .breq = breq,
> };
> struct xfs_trans *tp;
> + unsigned int iwalk_flags = 0;
> int error;
>
> if (breq->mnt_userns != &init_user_ns) {
> @@ -279,7 +280,10 @@ xfs_bulkstat(
> if (error)
> goto out;
>
> - error = xfs_iwalk(breq->mp, tp, breq->startino, breq->flags,
> + if (breq->flags & XFS_IBULK_SAME_AG)
> + iwalk_flags |= XFS_IWALK_SAME_AG;
> +
> + error = xfs_iwalk(breq->mp, tp, breq->startino, iwalk_flags,
> xfs_bulkstat_iwalk, breq->icount, &bc);
> xfs_trans_cancel(tp);
> out:
> diff --git a/fs/xfs/xfs_itable.h b/fs/xfs/xfs_itable.h
> index 7078d10c9b12..2cf3872fcd2f 100644
> --- a/fs/xfs/xfs_itable.h
> +++ b/fs/xfs/xfs_itable.h
> @@ -17,7 +17,7 @@ struct xfs_ibulk {
> };
>
> /* Only iterate within the same AG as startino */
> -#define XFS_IBULK_SAME_AG (XFS_IWALK_SAME_AG)
> +#define XFS_IBULK_SAME_AG (1 << 0)
>
> /*
> * Advance the user buffer pointer by one record of the given size. If the
> diff --git a/fs/xfs/xfs_iwalk.h b/fs/xfs/xfs_iwalk.h
> index 37a795f03267..3a68766fd909 100644
> --- a/fs/xfs/xfs_iwalk.h
> +++ b/fs/xfs/xfs_iwalk.h
> @@ -26,7 +26,7 @@ int xfs_iwalk_threaded(struct xfs_mount *mp, xfs_ino_t startino,
> unsigned int inode_records, bool poll, void *data);
>
> /* Only iterate inodes within the same AG as @startino. */
> -#define XFS_IWALK_SAME_AG (0x1)
> +#define XFS_IWALK_SAME_AG (1 << 0)
>
> #define XFS_IWALK_FLAGS_ALL (XFS_IWALK_SAME_AG)
>
> --
> 2.30.2
>