summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-08-28 17:37:57 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2019-08-30 00:22:41 -0400
commite7ee96dfb8c2687a29d2c5c3b06c967fa54b839c (patch)
tree185e9e79a3eff4ed5297ec13754ec7c927af7112
parent7f313eda8fcc6a250803abb1aef3d6dc5c32f9ad (diff)
xfs: remove all *_ITER_ABORT values
Use -ECANCELED to signal "stop iterating" instead of these magical *_ITER_ABORT values, since it's duplicative. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
-rw-r--r--fs/xfs/libxfs/xfs_btree.c12
-rw-r--r--fs/xfs/libxfs/xfs_btree.h9
-rw-r--r--fs/xfs/libxfs/xfs_rmap.c10
-rw-r--r--fs/xfs/libxfs/xfs_shared.h3
-rw-r--r--fs/xfs/scrub/agheader.c4
-rw-r--r--fs/xfs/scrub/attr.c2
-rw-r--r--fs/xfs/scrub/bmap.c4
-rw-r--r--fs/xfs/scrub/repair.c4
-rw-r--r--fs/xfs/xfs_dquot.c2
-rw-r--r--fs/xfs/xfs_fsmap.c4
-rw-r--r--fs/xfs/xfs_ioctl.c12
-rw-r--r--fs/xfs/xfs_itable.c6
-rw-r--r--fs/xfs/xfs_itable.h13
-rw-r--r--fs/xfs/xfs_iwalk.c2
-rw-r--r--fs/xfs/xfs_iwalk.h11
15 files changed, 54 insertions, 44 deletions
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index 802eb53c7a73..71de937f9e64 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -4598,7 +4598,7 @@ xfs_btree_simple_query_range(
4598 4598
4599 /* Callback */ 4599 /* Callback */
4600 error = fn(cur, recp, priv); 4600 error = fn(cur, recp, priv);
4601 if (error < 0 || error == XFS_BTREE_QUERY_RANGE_ABORT) 4601 if (error)
4602 break; 4602 break;
4603 4603
4604advloop: 4604advloop:
@@ -4700,8 +4700,7 @@ pop_up:
4700 */ 4700 */
4701 if (ldiff >= 0 && hdiff >= 0) { 4701 if (ldiff >= 0 && hdiff >= 0) {
4702 error = fn(cur, recp, priv); 4702 error = fn(cur, recp, priv);
4703 if (error < 0 || 4703 if (error)
4704 error == XFS_BTREE_QUERY_RANGE_ABORT)
4705 break; 4704 break;
4706 } else if (hdiff < 0) { 4705 } else if (hdiff < 0) {
4707 /* Record is larger than high key; pop. */ 4706 /* Record is larger than high key; pop. */
@@ -4772,8 +4771,7 @@ out:
4772 * Query a btree for all records overlapping a given interval of keys. The 4771 * Query a btree for all records overlapping a given interval of keys. The
4773 * supplied function will be called with each record found; return one of the 4772 * supplied function will be called with each record found; return one of the
4774 * XFS_BTREE_QUERY_RANGE_{CONTINUE,ABORT} values or the usual negative error 4773 * XFS_BTREE_QUERY_RANGE_{CONTINUE,ABORT} values or the usual negative error
4775 * code. This function returns XFS_BTREE_QUERY_RANGE_ABORT, zero, or a 4774 * code. This function returns -ECANCELED, zero, or a negative error code.
4776 * negative error code.
4777 */ 4775 */
4778int 4776int
4779xfs_btree_query_range( 4777xfs_btree_query_range(
@@ -4889,7 +4887,7 @@ xfs_btree_has_record_helper(
4889 union xfs_btree_rec *rec, 4887 union xfs_btree_rec *rec,
4890 void *priv) 4888 void *priv)
4891{ 4889{
4892 return XFS_BTREE_QUERY_RANGE_ABORT; 4890 return -ECANCELED;
4893} 4891}
4894 4892
4895/* Is there a record covering a given range of keys? */ 4893/* Is there a record covering a given range of keys? */
@@ -4904,7 +4902,7 @@ xfs_btree_has_record(
4904 4902
4905 error = xfs_btree_query_range(cur, low, high, 4903 error = xfs_btree_query_range(cur, low, high,
4906 &xfs_btree_has_record_helper, NULL); 4904 &xfs_btree_has_record_helper, NULL);
4907 if (error == XFS_BTREE_QUERY_RANGE_ABORT) { 4905 if (error == -ECANCELED) {
4908 *exists = true; 4906 *exists = true;
4909 return 0; 4907 return 0;
4910 } 4908 }
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
index fa3cd8ab9aba..326cf2a43f0d 100644
--- a/fs/xfs/libxfs/xfs_btree.h
+++ b/fs/xfs/libxfs/xfs_btree.h
@@ -464,9 +464,14 @@ xfs_failaddr_t xfs_btree_lblock_verify(struct xfs_buf *bp,
464uint xfs_btree_compute_maxlevels(uint *limits, unsigned long len); 464uint xfs_btree_compute_maxlevels(uint *limits, unsigned long len);
465unsigned long long xfs_btree_calc_size(uint *limits, unsigned long long len); 465unsigned long long xfs_btree_calc_size(uint *limits, unsigned long long len);
466 466
467/* return codes */ 467/*
468 * Return codes for the query range iterator function are 0 to continue
469 * iterating, and non-zero to stop iterating. Any non-zero value will be
470 * passed up to the _query_range caller. The special value -ECANCELED can be
471 * used to stop iteration, because _query_range never generates that error
472 * code on its own.
473 */
468#define XFS_BTREE_QUERY_RANGE_CONTINUE (XFS_ITER_CONTINUE) /* keep iterating */ 474#define XFS_BTREE_QUERY_RANGE_CONTINUE (XFS_ITER_CONTINUE) /* keep iterating */
469#define XFS_BTREE_QUERY_RANGE_ABORT (XFS_ITER_ABORT) /* stop iterating */
470typedef int (*xfs_btree_query_range_fn)(struct xfs_btree_cur *cur, 475typedef int (*xfs_btree_query_range_fn)(struct xfs_btree_cur *cur,
471 union xfs_btree_rec *rec, void *priv); 476 union xfs_btree_rec *rec, void *priv);
472 477
diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c
index 408dd2ec7a75..09644ff2c345 100644
--- a/fs/xfs/libxfs/xfs_rmap.c
+++ b/fs/xfs/libxfs/xfs_rmap.c
@@ -261,7 +261,7 @@ xfs_rmap_find_left_neighbor_helper(
261 261
262 *info->irec = *rec; 262 *info->irec = *rec;
263 *info->stat = 1; 263 *info->stat = 1;
264 return XFS_BTREE_QUERY_RANGE_ABORT; 264 return -ECANCELED;
265} 265}
266 266
267/* 267/*
@@ -304,7 +304,7 @@ xfs_rmap_find_left_neighbor(
304 304
305 error = xfs_rmap_query_range(cur, &info.high, &info.high, 305 error = xfs_rmap_query_range(cur, &info.high, &info.high,
306 xfs_rmap_find_left_neighbor_helper, &info); 306 xfs_rmap_find_left_neighbor_helper, &info);
307 if (error == XFS_BTREE_QUERY_RANGE_ABORT) 307 if (error == -ECANCELED)
308 error = 0; 308 error = 0;
309 if (*stat) 309 if (*stat)
310 trace_xfs_rmap_find_left_neighbor_result(cur->bc_mp, 310 trace_xfs_rmap_find_left_neighbor_result(cur->bc_mp,
@@ -338,7 +338,7 @@ xfs_rmap_lookup_le_range_helper(
338 338
339 *info->irec = *rec; 339 *info->irec = *rec;
340 *info->stat = 1; 340 *info->stat = 1;
341 return XFS_BTREE_QUERY_RANGE_ABORT; 341 return -ECANCELED;
342} 342}
343 343
344/* 344/*
@@ -376,7 +376,7 @@ xfs_rmap_lookup_le_range(
376 cur->bc_private.a.agno, bno, 0, owner, offset, flags); 376 cur->bc_private.a.agno, bno, 0, owner, offset, flags);
377 error = xfs_rmap_query_range(cur, &info.high, &info.high, 377 error = xfs_rmap_query_range(cur, &info.high, &info.high,
378 xfs_rmap_lookup_le_range_helper, &info); 378 xfs_rmap_lookup_le_range_helper, &info);
379 if (error == XFS_BTREE_QUERY_RANGE_ABORT) 379 if (error == -ECANCELED)
380 error = 0; 380 error = 0;
381 if (*stat) 381 if (*stat)
382 trace_xfs_rmap_lookup_le_range_result(cur->bc_mp, 382 trace_xfs_rmap_lookup_le_range_result(cur->bc_mp,
@@ -2509,7 +2509,7 @@ xfs_rmap_has_other_keys_helper(
2509 ((rks->flags & rec->rm_flags) & XFS_RMAP_KEY_FLAGS) == rks->flags) 2509 ((rks->flags & rec->rm_flags) & XFS_RMAP_KEY_FLAGS) == rks->flags)
2510 return 0; 2510 return 0;
2511 rks->has_rmap = true; 2511 rks->has_rmap = true;
2512 return XFS_BTREE_QUERY_RANGE_ABORT; 2512 return -ECANCELED;
2513} 2513}
2514 2514
2515/* 2515/*
diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
index e0641b7337b3..2bc31c5a0d49 100644
--- a/fs/xfs/libxfs/xfs_shared.h
+++ b/fs/xfs/libxfs/xfs_shared.h
@@ -180,7 +180,4 @@ struct xfs_ino_geometry {
180/* Keep iterating the data structure. */ 180/* Keep iterating the data structure. */
181#define XFS_ITER_CONTINUE (0) 181#define XFS_ITER_CONTINUE (0)
182 182
183/* Stop iterating the data structure. */
184#define XFS_ITER_ABORT (1)
185
186#endif /* __XFS_SHARED_H__ */ 183#endif /* __XFS_SHARED_H__ */
diff --git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
index 16b09b941441..ba0f747c82e8 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_ITER_ABORT; 642 return -ECANCELED;
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_ITER_ABORT) { 733 if (error == -ECANCELED) {
734 error = 0; 734 error = 0;
735 goto out_free; 735 goto out_free;
736 } 736 }
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index 922a5154e2b8..361387026513 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -173,7 +173,7 @@ xchk_xattr_listent(
173 args.blkno); 173 args.blkno);
174fail_xref: 174fail_xref:
175 if (sx->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 175 if (sx->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
176 context->seen_enough = XFS_ITER_ABORT; 176 context->seen_enough = 1;
177 return; 177 return;
178} 178}
179 179
diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c
index 7b19c63e12ce..fa6ea6407992 100644
--- a/fs/xfs/scrub/bmap.c
+++ b/fs/xfs/scrub/bmap.c
@@ -522,7 +522,7 @@ xchk_bmap_check_rmap(
522 522
523out: 523out:
524 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 524 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
525 return XFS_BTREE_QUERY_RANGE_ABORT; 525 return -ECANCELED;
526 return 0; 526 return 0;
527} 527}
528 528
@@ -551,7 +551,7 @@ xchk_bmap_check_ag_rmaps(
551 sbcri.sc = sc; 551 sbcri.sc = sc;
552 sbcri.whichfork = whichfork; 552 sbcri.whichfork = whichfork;
553 error = xfs_rmap_query_all(cur, xchk_bmap_check_rmap, &sbcri); 553 error = xfs_rmap_query_all(cur, xchk_bmap_check_rmap, &sbcri);
554 if (error == XFS_BTREE_QUERY_RANGE_ABORT) 554 if (error == -ECANCELED)
555 error = 0; 555 error = 0;
556 556
557 xfs_btree_del_cursor(cur, error); 557 xfs_btree_del_cursor(cur, error);
diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c
index 7bcc755beb40..b70a88bc975e 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_ITER_ABORT : 0; 667 return (*agbno == bno) ? -ECANCELED : 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_ITER_ABORT) 697 if (error == -ECANCELED)
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 7ce770e779b4..aeb95e7391c1 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_ITER_ABORT to indicate that it wants to stop iterating. 1242 * or -ECANCELED to indicate that it wants to stop iterating.
1243 */ 1243 */
1244int 1244int
1245xfs_qm_dqiterate( 1245xfs_qm_dqiterate(
diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c
index 5a8f9641562a..8ab4ab56fa89 100644
--- a/fs/xfs/xfs_fsmap.c
+++ b/fs/xfs/xfs_fsmap.c
@@ -276,7 +276,7 @@ xfs_getfsmap_helper(
276 */ 276 */
277 if (rec_daddr > info->next_daddr) { 277 if (rec_daddr > info->next_daddr) {
278 if (info->head->fmh_entries >= info->head->fmh_count) 278 if (info->head->fmh_entries >= info->head->fmh_count)
279 return XFS_BTREE_QUERY_RANGE_ABORT; 279 return -ECANCELED;
280 280
281 fmr.fmr_device = info->dev; 281 fmr.fmr_device = info->dev;
282 fmr.fmr_physical = info->next_daddr; 282 fmr.fmr_physical = info->next_daddr;
@@ -295,7 +295,7 @@ xfs_getfsmap_helper(
295 295
296 /* Fill out the extent we found */ 296 /* Fill out the extent we found */
297 if (info->head->fmh_entries >= info->head->fmh_count) 297 if (info->head->fmh_entries >= info->head->fmh_count)
298 return XFS_BTREE_QUERY_RANGE_ABORT; 298 return -ECANCELED;
299 299
300 trace_xfs_fsmap_mapping(mp, info->dev, info->agno, rec); 300 trace_xfs_fsmap_mapping(mp, info->dev, info->agno, rec);
301 301
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 9ea51664932e..e6f1e4739758 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -831,7 +831,7 @@ xfs_bulkstat_fmt(
831/* 831/*
832 * Check the incoming bulk request @hdr from userspace and initialize the 832 * Check the incoming bulk request @hdr from userspace and initialize the
833 * internal @breq bulk request appropriately. Returns 0 if the bulk request 833 * internal @breq bulk request appropriately. Returns 0 if the bulk request
834 * should proceed; XFS_ITER_ABORT if there's nothing to do; or the usual 834 * should proceed; -ECANCELED if there's nothing to do; or the usual
835 * negative error code. 835 * negative error code.
836 */ 836 */
837static int 837static int
@@ -889,13 +889,13 @@ xfs_bulk_ireq_setup(
889 889
890 /* Asking for an inode past the end of the AG? We're done! */ 890 /* Asking for an inode past the end of the AG? We're done! */
891 if (XFS_INO_TO_AGNO(mp, breq->startino) > hdr->agno) 891 if (XFS_INO_TO_AGNO(mp, breq->startino) > hdr->agno)
892 return XFS_ITER_ABORT; 892 return -ECANCELED;
893 } else if (hdr->agno) 893 } else if (hdr->agno)
894 return -EINVAL; 894 return -EINVAL;
895 895
896 /* Asking for an inode past the end of the FS? We're done! */ 896 /* Asking for an inode past the end of the FS? We're done! */
897 if (XFS_INO_TO_AGNO(mp, breq->startino) >= mp->m_sb.sb_agcount) 897 if (XFS_INO_TO_AGNO(mp, breq->startino) >= mp->m_sb.sb_agcount)
898 return XFS_ITER_ABORT; 898 return -ECANCELED;
899 899
900 return 0; 900 return 0;
901} 901}
@@ -936,7 +936,7 @@ xfs_ioc_bulkstat(
936 return -EFAULT; 936 return -EFAULT;
937 937
938 error = xfs_bulk_ireq_setup(mp, &hdr, &breq, arg->bulkstat); 938 error = xfs_bulk_ireq_setup(mp, &hdr, &breq, arg->bulkstat);
939 if (error == XFS_ITER_ABORT) 939 if (error == -ECANCELED)
940 goto out_teardown; 940 goto out_teardown;
941 if (error < 0) 941 if (error < 0)
942 return error; 942 return error;
@@ -986,7 +986,7 @@ xfs_ioc_inumbers(
986 return -EFAULT; 986 return -EFAULT;
987 987
988 error = xfs_bulk_ireq_setup(mp, &hdr, &breq, arg->inumbers); 988 error = xfs_bulk_ireq_setup(mp, &hdr, &breq, arg->inumbers);
989 if (error == XFS_ITER_ABORT) 989 if (error == -ECANCELED)
990 goto out_teardown; 990 goto out_teardown;
991 if (error < 0) 991 if (error < 0)
992 return error; 992 return error;
@@ -1881,7 +1881,7 @@ xfs_ioc_getfsmap(
1881 info.mp = ip->i_mount; 1881 info.mp = ip->i_mount;
1882 info.data = arg; 1882 info.data = arg;
1883 error = xfs_getfsmap(ip->i_mount, &xhead, xfs_getfsmap_format, &info); 1883 error = xfs_getfsmap(ip->i_mount, &xhead, xfs_getfsmap_format, &info);
1884 if (error == XFS_BTREE_QUERY_RANGE_ABORT) { 1884 if (error == -ECANCELED) {
1885 error = 0; 1885 error = 0;
1886 aborted = true; 1886 aborted = true;
1887 } else if (error) 1887 } else if (error)
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index b049e7369a66..884950adbd16 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -137,7 +137,7 @@ xfs_bulkstat_one_int(
137 xfs_irele(ip); 137 xfs_irele(ip);
138 138
139 error = bc->formatter(bc->breq, buf); 139 error = bc->formatter(bc->breq, buf);
140 if (error == XFS_IBULK_ABORT) 140 if (error == -ECANCELED)
141 goto out_advance; 141 goto out_advance;
142 if (error) 142 if (error)
143 goto out; 143 goto out;
@@ -181,7 +181,7 @@ xfs_bulkstat_one(
181 * If we reported one inode to userspace then we abort because we hit 181 * If we reported one inode to userspace then we abort because we hit
182 * the end of the buffer. Don't leak that back to userspace. 182 * the end of the buffer. Don't leak that back to userspace.
183 */ 183 */
184 if (error == XFS_IWALK_ABORT) 184 if (error == -ECANCELED)
185 error = 0; 185 error = 0;
186 186
187 return error; 187 return error;
@@ -342,7 +342,7 @@ xfs_inumbers_walk(
342 int error; 342 int error;
343 343
344 error = ic->formatter(ic->breq, &inogrp); 344 error = ic->formatter(ic->breq, &inogrp);
345 if (error && error != XFS_IBULK_ABORT) 345 if (error && error != -ECANCELED)
346 return error; 346 return error;
347 347
348 ic->breq->startino = XFS_AGINO_TO_INO(mp, agno, irec->ir_startino) + 348 ic->breq->startino = XFS_AGINO_TO_INO(mp, agno, irec->ir_startino) +
diff --git a/fs/xfs/xfs_itable.h b/fs/xfs/xfs_itable.h
index e90c1fc5b981..96a1e2a9be3f 100644
--- a/fs/xfs/xfs_itable.h
+++ b/fs/xfs/xfs_itable.h
@@ -18,9 +18,6 @@ struct xfs_ibulk {
18/* Only iterate within the same AG as startino */ 18/* Only iterate within the same AG as startino */
19#define XFS_IBULK_SAME_AG (XFS_IWALK_SAME_AG) 19#define XFS_IBULK_SAME_AG (XFS_IWALK_SAME_AG)
20 20
21/* Return value that means we want to abort the walk. */
22#define XFS_IBULK_ABORT (XFS_IWALK_ABORT)
23
24/* 21/*
25 * Advance the user buffer pointer by one record of the given size. If the 22 * Advance the user buffer pointer by one record of the given size. If the
26 * buffer is now full, return the appropriate error code. 23 * buffer is now full, return the appropriate error code.
@@ -34,13 +31,21 @@ xfs_ibulk_advance(
34 31
35 breq->ubuffer = b + bytes; 32 breq->ubuffer = b + bytes;
36 breq->ocount++; 33 breq->ocount++;
37 return breq->ocount == breq->icount ? XFS_IBULK_ABORT : 0; 34 return breq->ocount == breq->icount ? -ECANCELED : 0;
38} 35}
39 36
40/* 37/*
41 * Return stat information in bulk (by-inode) for the filesystem. 38 * Return stat information in bulk (by-inode) for the filesystem.
42 */ 39 */
43 40
41/*
42 * Return codes for the formatter function are 0 to continue iterating, and
43 * non-zero to stop iterating. Any non-zero value will be passed up to the
44 * bulkstat/inumbers caller. The special value -ECANCELED can be used to stop
45 * iteration, as neither bulkstat nor inumbers will ever generate that error
46 * code on their own.
47 */
48
44typedef int (*bulkstat_one_fmt_pf)(struct xfs_ibulk *breq, 49typedef int (*bulkstat_one_fmt_pf)(struct xfs_ibulk *breq,
45 const struct xfs_bulkstat *bstat); 50 const struct xfs_bulkstat *bstat);
46 51
diff --git a/fs/xfs/xfs_iwalk.c b/fs/xfs/xfs_iwalk.c
index 86ce52c1871f..aa375cf53021 100644
--- a/fs/xfs/xfs_iwalk.c
+++ b/fs/xfs/xfs_iwalk.c
@@ -31,7 +31,7 @@
31 * inode it finds, it calls a walk function with the relevant inode number and 31 * inode it finds, it calls a walk function with the relevant inode number and
32 * a pointer to caller-provided data. The walk function can return the usual 32 * a pointer to caller-provided data. The walk function can return the usual
33 * negative error code to stop the iteration; 0 to continue the iteration; or 33 * negative error code to stop the iteration; 0 to continue the iteration; or
34 * XFS_IWALK_ABORT to stop the iteration. This return value is returned to the 34 * -ECANCELED to stop the iteration. This return value is returned to the
35 * caller. 35 * caller.
36 * 36 *
37 * Internally, we allow the walk function to do anything, which means that we 37 * Internally, we allow the walk function to do anything, which means that we
diff --git a/fs/xfs/xfs_iwalk.h b/fs/xfs/xfs_iwalk.h
index 6c960e10ed4d..742360d51378 100644
--- a/fs/xfs/xfs_iwalk.h
+++ b/fs/xfs/xfs_iwalk.h
@@ -6,12 +6,19 @@
6#ifndef __XFS_IWALK_H__ 6#ifndef __XFS_IWALK_H__
7#define __XFS_IWALK_H__ 7#define __XFS_IWALK_H__
8 8
9/*
10 * Return codes for the inode/inobt walk function are 0 to continue iterating,
11 * and non-zero to stop iterating. Any non-zero value will be passed up to the
12 * iwalk or inobt_walk caller. The special value -ECANCELED can be used to
13 * stop iteration, as neither iwalk nor inobt_walk will ever generate that
14 * error code on their own.
15 */
16
9/* Walk all inodes in the filesystem starting from @startino. */ 17/* Walk all inodes in the filesystem starting from @startino. */
10typedef int (*xfs_iwalk_fn)(struct xfs_mount *mp, struct xfs_trans *tp, 18typedef int (*xfs_iwalk_fn)(struct xfs_mount *mp, struct xfs_trans *tp,
11 xfs_ino_t ino, void *data); 19 xfs_ino_t ino, void *data);
12/* Return values for xfs_iwalk_fn. */ 20/* Return values for xfs_iwalk_fn. */
13#define XFS_IWALK_CONTINUE (XFS_ITER_CONTINUE) 21#define XFS_IWALK_CONTINUE (XFS_ITER_CONTINUE)
14#define XFS_IWALK_ABORT (XFS_ITER_ABORT)
15 22
16int xfs_iwalk(struct xfs_mount *mp, struct xfs_trans *tp, xfs_ino_t startino, 23int xfs_iwalk(struct xfs_mount *mp, struct xfs_trans *tp, xfs_ino_t startino,
17 unsigned int flags, xfs_iwalk_fn iwalk_fn, 24 unsigned int flags, xfs_iwalk_fn iwalk_fn,
@@ -30,8 +37,6 @@ typedef int (*xfs_inobt_walk_fn)(struct xfs_mount *mp, struct xfs_trans *tp,
30 xfs_agnumber_t agno, 37 xfs_agnumber_t agno,
31 const struct xfs_inobt_rec_incore *irec, 38 const struct xfs_inobt_rec_incore *irec,
32 void *data); 39 void *data);
33/* Return value (for xfs_inobt_walk_fn) that aborts the walk immediately. */
34#define XFS_INOBT_WALK_ABORT (XFS_IWALK_ABORT)
35 40
36int xfs_inobt_walk(struct xfs_mount *mp, struct xfs_trans *tp, 41int xfs_inobt_walk(struct xfs_mount *mp, struct xfs_trans *tp,
37 xfs_ino_t startino, unsigned int flags, 42 xfs_ino_t startino, unsigned int flags,