2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

xfs: remove XFS_IBULK_SAME_AG

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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Christoph Hellwig 2025-07-23 14:19:45 +02:00 committed by Carlos Maiolino
parent d2845519b0
commit 82efde9cf2
3 changed files with 7 additions and 17 deletions

View File

@ -219,7 +219,7 @@ xfs_bulk_ireq_setup(
else if (XFS_INO_TO_AGNO(mp, breq->startino) < hdr->agno) else if (XFS_INO_TO_AGNO(mp, breq->startino) < hdr->agno)
return -EINVAL; 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! */ /* Asking for an inode past the end of the AG? We're done! */
if (XFS_INO_TO_AGNO(mp, breq->startino) > hdr->agno) if (XFS_INO_TO_AGNO(mp, breq->startino) > hdr->agno)

View File

@ -307,7 +307,6 @@ xfs_bulkstat(
.breq = breq, .breq = breq,
}; };
struct xfs_trans *tp; struct xfs_trans *tp;
unsigned int iwalk_flags = 0;
int error; int error;
if (breq->idmap != &nop_mnt_idmap) { if (breq->idmap != &nop_mnt_idmap) {
@ -328,10 +327,7 @@ xfs_bulkstat(
* locking abilities to detect cycles in the inobt without deadlocking. * locking abilities to detect cycles in the inobt without deadlocking.
*/ */
tp = xfs_trans_alloc_empty(breq->mp); tp = xfs_trans_alloc_empty(breq->mp);
if (breq->flags & XFS_IBULK_SAME_AG) error = xfs_iwalk(breq->mp, tp, breq->startino, breq->iwalk_flags,
iwalk_flags |= XFS_IWALK_SAME_AG;
error = xfs_iwalk(breq->mp, tp, breq->startino, iwalk_flags,
xfs_bulkstat_iwalk, breq->icount, &bc); xfs_bulkstat_iwalk, breq->icount, &bc);
xfs_trans_cancel(tp); xfs_trans_cancel(tp);
kfree(bc.buf); kfree(bc.buf);
@ -447,21 +443,17 @@ xfs_inumbers(
.breq = breq, .breq = breq,
}; };
struct xfs_trans *tp; struct xfs_trans *tp;
unsigned int iwalk_flags = 0;
int error = 0; int error = 0;
if (xfs_bulkstat_already_done(breq->mp, breq->startino)) if (xfs_bulkstat_already_done(breq->mp, breq->startino))
return 0; 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 * Grab an empty transaction so that we can use its recursive buffer
* locking abilities to detect cycles in the inobt without deadlocking. * locking abilities to detect cycles in the inobt without deadlocking.
*/ */
tp = xfs_trans_alloc_empty(breq->mp); 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_inumbers_walk, breq->icount, &ic);
xfs_trans_cancel(tp); xfs_trans_cancel(tp);

View File

@ -13,17 +13,15 @@ struct xfs_ibulk {
xfs_ino_t startino; /* start with this inode */ xfs_ino_t startino; /* start with this inode */
unsigned int icount; /* number of elements in ubuffer */ unsigned int icount; /* number of elements in ubuffer */
unsigned int ocount; /* number of records returned */ 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. */ /* 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. */ /* 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 * Advance the user buffer pointer by one record of the given size. If the