]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: remove all *_ITER_ABORT values
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 15 Nov 2019 22:16:22 +0000 (17:16 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 15 Nov 2019 22:16:22 +0000 (17:16 -0500)
Source kernel commit: e7ee96dfb8c2687a29d2c5c3b06c967fa54b839c

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>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net
libxfs/xfs_btree.c
libxfs/xfs_btree.h
libxfs/xfs_rmap.c
libxfs/xfs_shared.h

index 2431904801c479dff2fb8afd0ee4dc76f7fedccf..4ccfdea0b3ed927c02060c484e4e09fe4771c480 100644 (file)
@@ -4597,7 +4597,7 @@ xfs_btree_simple_query_range(
 
                /* Callback */
                error = fn(cur, recp, priv);
-               if (error < 0 || error == XFS_BTREE_QUERY_RANGE_ABORT)
+               if (error)
                        break;
 
 advloop:
@@ -4699,8 +4699,7 @@ pop_up:
                         */
                        if (ldiff >= 0 && hdiff >= 0) {
                                error = fn(cur, recp, priv);
-                               if (error < 0 ||
-                                   error == XFS_BTREE_QUERY_RANGE_ABORT)
+                               if (error)
                                        break;
                        } else if (hdiff < 0) {
                                /* Record is larger than high key; pop. */
@@ -4771,8 +4770,7 @@ out:
  * Query a btree for all records overlapping a given interval of keys.  The
  * supplied function will be called with each record found; return one of the
  * XFS_BTREE_QUERY_RANGE_{CONTINUE,ABORT} values or the usual negative error
- * code.  This function returns XFS_BTREE_QUERY_RANGE_ABORT, zero, or a
- * negative error code.
+ * code.  This function returns -ECANCELED, zero, or a negative error code.
  */
 int
 xfs_btree_query_range(
@@ -4888,7 +4886,7 @@ xfs_btree_has_record_helper(
        union xfs_btree_rec             *rec,
        void                            *priv)
 {
-       return XFS_BTREE_QUERY_RANGE_ABORT;
+       return -ECANCELED;
 }
 
 /* Is there a record covering a given range of keys? */
@@ -4903,7 +4901,7 @@ xfs_btree_has_record(
 
        error = xfs_btree_query_range(cur, low, high,
                        &xfs_btree_has_record_helper, NULL);
-       if (error == XFS_BTREE_QUERY_RANGE_ABORT) {
+       if (error == -ECANCELED) {
                *exists = true;
                return 0;
        }
index 80b7f9e97fe3fbfbac3ef26864000954fc55bc2f..cc2cf6bcce0166b6380e5bc4d267f8d912cc5a9e 100644 (file)
@@ -464,9 +464,14 @@ xfs_failaddr_t xfs_btree_lblock_verify(struct xfs_buf *bp,
 uint xfs_btree_compute_maxlevels(uint *limits, unsigned long len);
 unsigned long long xfs_btree_calc_size(uint *limits, unsigned long long len);
 
-/* return codes */
+/*
+ * Return codes for the query range iterator function are 0 to continue
+ * iterating, and non-zero to stop iterating.  Any non-zero value will be
+ * passed up to the _query_range caller.  The special value -ECANCELED can be
+ * used to stop iteration, because _query_range never generates that error
+ * code on its own.
+ */
 #define XFS_BTREE_QUERY_RANGE_CONTINUE (XFS_ITER_CONTINUE) /* keep iterating */
-#define XFS_BTREE_QUERY_RANGE_ABORT    (XFS_ITER_ABORT)    /* stop iterating */
 typedef int (*xfs_btree_query_range_fn)(struct xfs_btree_cur *cur,
                union xfs_btree_rec *rec, void *priv);
 
index 34739ff2ff19d48023d993eaf8e265924565a780..9129bbd09765aec96a99e1a50aad83734f1ee001 100644 (file)
@@ -259,7 +259,7 @@ xfs_rmap_find_left_neighbor_helper(
 
        *info->irec = *rec;
        *info->stat = 1;
-       return XFS_BTREE_QUERY_RANGE_ABORT;
+       return -ECANCELED;
 }
 
 /*
@@ -302,7 +302,7 @@ xfs_rmap_find_left_neighbor(
 
        error = xfs_rmap_query_range(cur, &info.high, &info.high,
                        xfs_rmap_find_left_neighbor_helper, &info);
-       if (error == XFS_BTREE_QUERY_RANGE_ABORT)
+       if (error == -ECANCELED)
                error = 0;
        if (*stat)
                trace_xfs_rmap_find_left_neighbor_result(cur->bc_mp,
@@ -336,7 +336,7 @@ xfs_rmap_lookup_le_range_helper(
 
        *info->irec = *rec;
        *info->stat = 1;
-       return XFS_BTREE_QUERY_RANGE_ABORT;
+       return -ECANCELED;
 }
 
 /*
@@ -374,7 +374,7 @@ xfs_rmap_lookup_le_range(
                        cur->bc_private.a.agno, bno, 0, owner, offset, flags);
        error = xfs_rmap_query_range(cur, &info.high, &info.high,
                        xfs_rmap_lookup_le_range_helper, &info);
-       if (error == XFS_BTREE_QUERY_RANGE_ABORT)
+       if (error == -ECANCELED)
                error = 0;
        if (*stat)
                trace_xfs_rmap_lookup_le_range_result(cur->bc_mp,
@@ -2507,7 +2507,7 @@ xfs_rmap_has_other_keys_helper(
            ((rks->flags & rec->rm_flags) & XFS_RMAP_KEY_FLAGS) == rks->flags)
                return 0;
        rks->has_rmap = true;
-       return XFS_BTREE_QUERY_RANGE_ABORT;
+       return -ECANCELED;
 }
 
 /*
index e0641b7337b3cf27fb6b0fd4a5953691901e0154..2bc31c5a0d492b04da65c719461e5a26767e1010 100644 (file)
@@ -180,7 +180,4 @@ struct xfs_ino_geometry {
 /* Keep iterating the data structure. */
 #define XFS_ITER_CONTINUE      (0)
 
-/* Stop iterating the data structure. */
-#define XFS_ITER_ABORT         (1)
-
 #endif /* __XFS_SHARED_H__ */