Commit e7ee96df authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

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: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 7f313eda
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -4598,7 +4598,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:
@@ -4700,8 +4700,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. */
@@ -4772,8 +4771,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(
@@ -4889,7 +4887,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? */
@@ -4904,7 +4902,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;
	}
+7 −2
Original line number Diff line number Diff line
@@ -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);

+5 −5
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ xfs_rmap_find_left_neighbor_helper(

	*info->irec = *rec;
	*info->stat = 1;
	return XFS_BTREE_QUERY_RANGE_ABORT;
	return -ECANCELED;
}

/*
@@ -304,7 +304,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,
@@ -338,7 +338,7 @@ xfs_rmap_lookup_le_range_helper(

	*info->irec = *rec;
	*info->stat = 1;
	return XFS_BTREE_QUERY_RANGE_ABORT;
	return -ECANCELED;
}

/*
@@ -376,7 +376,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,
@@ -2509,7 +2509,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;
}

/*
+0 −3
Original line number Diff line number Diff line
@@ -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__ */
+2 −2
Original line number Diff line number Diff line
@@ -639,7 +639,7 @@ xchk_agfl_block(
	xchk_agfl_block_xref(sc, agbno);

	if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
		return XFS_ITER_ABORT;
		return -ECANCELED;

	return 0;
}
@@ -730,7 +730,7 @@ xchk_agfl(
	/* Check the blocks in the AGFL. */
	error = xfs_agfl_walk(sc->mp, XFS_BUF_TO_AGF(sc->sa.agf_bp),
			sc->sa.agfl_bp, xchk_agfl_block, &sai);
	if (error == XFS_ITER_ABORT) {
	if (error == -ECANCELED) {
		error = 0;
		goto out_free;
	}
Loading