summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2021-06-02 03:48:24 +0300
committerDave Chinner <david@fromorbit.com>2021-06-02 03:48:24 +0300
commit6f4118fc6482b1989cdcb19a1a0ab53b2dca7ab9 (patch)
treed9e8f843ce4746975be4c84dd83a179df94e1e48 /fs/xfs/libxfs
parent934933c3eec9e4a5826d3d7a47aca0742337fded (diff)
downloadlinux-6f4118fc6482b1989cdcb19a1a0ab53b2dca7ab9.tar.xz
xfs: convert xfs_iwalk to use perag references
Rather than manually walking the ags and passing agnunbers around, pass the perag for the AG we are currently working on around in the iwalk structure. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r--fs/xfs/libxfs/xfs_ag.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/xfs/libxfs/xfs_ag.h b/fs/xfs/libxfs/xfs_ag.h
index 33783120263c..f87a60a4a849 100644
--- a/fs/xfs/libxfs/xfs_ag.h
+++ b/fs/xfs/libxfs/xfs_ag.h
@@ -117,19 +117,23 @@ void xfs_perag_put(struct xfs_perag *pag);
/*
* Perag iteration APIs
*/
-#define for_each_perag(mp, next_agno, pag) \
- for ((next_agno) = 0, (pag) = xfs_perag_get((mp), 0); \
+#define for_each_perag_from(mp, next_agno, pag) \
+ for ((pag) = xfs_perag_get((mp), (next_agno)); \
(pag) != NULL; \
(next_agno) = (pag)->pag_agno + 1, \
xfs_perag_put(pag), \
(pag) = xfs_perag_get((mp), (next_agno)))
-#define for_each_perag_tag(mp, next_agno, pag, tag) \
- for ((next_agno) = 0, (pag) = xfs_perag_get_tag((mp), 0, (tag)); \
+#define for_each_perag(mp, agno, pag) \
+ (agno) = 0; \
+ for_each_perag_from((mp), (agno), (pag))
+
+#define for_each_perag_tag(mp, agno, pag, tag) \
+ for ((agno) = 0, (pag) = xfs_perag_get_tag((mp), 0, (tag)); \
(pag) != NULL; \
- (next_agno) = (pag)->pag_agno + 1, \
+ (agno) = (pag)->pag_agno + 1, \
xfs_perag_put(pag), \
- (pag) = xfs_perag_get_tag((mp), (next_agno), (tag)))
+ (pag) = xfs_perag_get_tag((mp), (agno), (tag)))
struct aghdr_init_data {
/* per ag data */