diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2019-07-02 12:39:38 -0400 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-07-02 12:40:05 -0400 |
commit | 5bb46e3e180d28c7ee6715f47c344be366a3fcc8 (patch) | |
tree | 77742ba38d13667139519c36bc92662017c724fa | |
parent | 73d30d48749f883fbaaf68ef5d774e99ffafda5d (diff) |
xfs: create iterator error codes
Currently, xfs doesn't have generic error codes defined for "stop
iterating"; we just reuse the XFS_BTREE_QUERY_* return values. This
looks a little weird if we're not actually iterating a btree index.
Before we start adding more iterators, we should create general
XFS_ITER_{CONTINUE,ABORT} return values and define the XFS_BTREE_QUERY_*
ones from that.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
-rw-r--r-- | fs/xfs/libxfs/xfs_alloc.c | 2 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_btree.h | 4 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_shared.h | 6 | ||||
-rw-r--r-- | fs/xfs/scrub/agheader.c | 4 | ||||
-rw-r--r-- | fs/xfs/scrub/repair.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot.c | 2 |
6 files changed, 14 insertions, 8 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index ae2d91b0e9e9..372ad55631fc 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c | |||
@@ -3137,7 +3137,7 @@ xfs_alloc_has_record( | |||
3137 | 3137 | ||
3138 | /* | 3138 | /* |
3139 | * Walk all the blocks in the AGFL. The @walk_fn can return any negative | 3139 | * Walk all the blocks in the AGFL. The @walk_fn can return any negative |
3140 | * error code or XFS_BTREE_QUERY_RANGE_ABORT. | 3140 | * error code or XFS_ITER_*. |
3141 | */ | 3141 | */ |
3142 | int | 3142 | int |
3143 | xfs_agfl_walk( | 3143 | xfs_agfl_walk( |
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h index 8d2b250c6828..fa3cd8ab9aba 100644 --- a/fs/xfs/libxfs/xfs_btree.h +++ b/fs/xfs/libxfs/xfs_btree.h | |||
@@ -465,8 +465,8 @@ uint xfs_btree_compute_maxlevels(uint *limits, unsigned long len); | |||
465 | unsigned long long xfs_btree_calc_size(uint *limits, unsigned long long len); | 465 | unsigned long long xfs_btree_calc_size(uint *limits, unsigned long long len); |
466 | 466 | ||
467 | /* return codes */ | 467 | /* return codes */ |
468 | #define XFS_BTREE_QUERY_RANGE_CONTINUE 0 /* keep iterating */ | 468 | #define XFS_BTREE_QUERY_RANGE_CONTINUE (XFS_ITER_CONTINUE) /* keep iterating */ |
469 | #define XFS_BTREE_QUERY_RANGE_ABORT 1 /* stop iterating */ | 469 | #define XFS_BTREE_QUERY_RANGE_ABORT (XFS_ITER_ABORT) /* stop iterating */ |
470 | typedef int (*xfs_btree_query_range_fn)(struct xfs_btree_cur *cur, | 470 | typedef int (*xfs_btree_query_range_fn)(struct xfs_btree_cur *cur, |
471 | union xfs_btree_rec *rec, void *priv); | 471 | union xfs_btree_rec *rec, void *priv); |
472 | 472 | ||
diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h index c45acbd3add9..e0641b7337b3 100644 --- a/fs/xfs/libxfs/xfs_shared.h +++ b/fs/xfs/libxfs/xfs_shared.h | |||
@@ -177,4 +177,10 @@ struct xfs_ino_geometry { | |||
177 | unsigned int agino_log; /* #bits for agino in inum */ | 177 | unsigned int agino_log; /* #bits for agino in inum */ |
178 | }; | 178 | }; |
179 | 179 | ||
180 | /* Keep iterating the data structure. */ | ||
181 | #define XFS_ITER_CONTINUE (0) | ||
182 | |||
183 | /* Stop iterating the data structure. */ | ||
184 | #define XFS_ITER_ABORT (1) | ||
185 | |||
180 | #endif /* __XFS_SHARED_H__ */ | 186 | #endif /* __XFS_SHARED_H__ */ |
diff --git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c index 5e3fc9f3de13..16b09b941441 100644 --- a/fs/xfs/scrub/agheader.c +++ b/fs/xfs/scrub/agheader.c | |||
@@ -639,7 +639,7 @@ xchk_agfl_block( | |||
639 | xchk_agfl_block_xref(sc, agbno); | 639 | xchk_agfl_block_xref(sc, agbno); |
640 | 640 | ||
641 | if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) | 641 | if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) |
642 | return XFS_BTREE_QUERY_RANGE_ABORT; | 642 | return XFS_ITER_ABORT; |
643 | 643 | ||
644 | return 0; | 644 | return 0; |
645 | } | 645 | } |
@@ -730,7 +730,7 @@ xchk_agfl( | |||
730 | /* Check the blocks in the AGFL. */ | 730 | /* Check the blocks in the AGFL. */ |
731 | error = xfs_agfl_walk(sc->mp, XFS_BUF_TO_AGF(sc->sa.agf_bp), | 731 | error = xfs_agfl_walk(sc->mp, XFS_BUF_TO_AGF(sc->sa.agf_bp), |
732 | sc->sa.agfl_bp, xchk_agfl_block, &sai); | 732 | sc->sa.agfl_bp, xchk_agfl_block, &sai); |
733 | if (error == XFS_BTREE_QUERY_RANGE_ABORT) { | 733 | if (error == XFS_ITER_ABORT) { |
734 | error = 0; | 734 | error = 0; |
735 | goto out_free; | 735 | goto out_free; |
736 | } | 736 | } |
diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c index 4d3194a2327a..4cfeec57fb05 100644 --- a/fs/xfs/scrub/repair.c +++ b/fs/xfs/scrub/repair.c | |||
@@ -664,7 +664,7 @@ xrep_findroot_agfl_walk( | |||
664 | { | 664 | { |
665 | xfs_agblock_t *agbno = priv; | 665 | xfs_agblock_t *agbno = priv; |
666 | 666 | ||
667 | return (*agbno == bno) ? XFS_BTREE_QUERY_RANGE_ABORT : 0; | 667 | return (*agbno == bno) ? XFS_ITER_ABORT : 0; |
668 | } | 668 | } |
669 | 669 | ||
670 | /* Does this block match the btree information passed in? */ | 670 | /* Does this block match the btree information passed in? */ |
@@ -694,7 +694,7 @@ xrep_findroot_block( | |||
694 | if (owner == XFS_RMAP_OWN_AG) { | 694 | if (owner == XFS_RMAP_OWN_AG) { |
695 | error = xfs_agfl_walk(mp, ri->agf, ri->agfl_bp, | 695 | error = xfs_agfl_walk(mp, ri->agf, ri->agfl_bp, |
696 | xrep_findroot_agfl_walk, &agbno); | 696 | xrep_findroot_agfl_walk, &agbno); |
697 | if (error == XFS_BTREE_QUERY_RANGE_ABORT) | 697 | if (error == XFS_ITER_ABORT) |
698 | return 0; | 698 | return 0; |
699 | if (error) | 699 | if (error) |
700 | return error; | 700 | return error; |
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 2dfbfcdc16f4..fb1ad4483081 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
@@ -1239,7 +1239,7 @@ xfs_qm_exit(void) | |||
1239 | /* | 1239 | /* |
1240 | * Iterate every dquot of a particular type. The caller must ensure that the | 1240 | * Iterate every dquot of a particular type. The caller must ensure that the |
1241 | * particular quota type is active. iter_fn can return negative error codes, | 1241 | * particular quota type is active. iter_fn can return negative error codes, |
1242 | * or XFS_BTREE_QUERY_RANGE_ABORT to indicate that it wants to stop iterating. | 1242 | * or XFS_ITER_ABORT to indicate that it wants to stop iterating. |
1243 | */ | 1243 | */ |
1244 | int | 1244 | int |
1245 | xfs_qm_dqiterate( | 1245 | xfs_qm_dqiterate( |