Commit edce1724 authored by Fedor Pchelkin's avatar Fedor Pchelkin Committed by Carlos Maiolino
Browse files

xfs: rename diff_two_keys routines



One may think that diff_two_keys routines are used to compute the actual
difference between the arguments but they return a result of a
three-way-comparison of the passed operands. So it looks more appropriate
to denote them as cmp_two_keys.

Found by Linux Verification Center (linuxtesting.org).

Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
parent e0a05579
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ xfs_cntbt_key_diff(
}

STATIC int64_t
xfs_bnobt_diff_two_keys(
xfs_bnobt_cmp_two_keys(
	struct xfs_btree_cur		*cur,
	const union xfs_btree_key	*k1,
	const union xfs_btree_key	*k2,
@@ -227,7 +227,7 @@ xfs_bnobt_diff_two_keys(
}

STATIC int64_t
xfs_cntbt_diff_two_keys(
xfs_cntbt_cmp_two_keys(
	struct xfs_btree_cur		*cur,
	const union xfs_btree_key	*k1,
	const union xfs_btree_key	*k2,
@@ -440,7 +440,7 @@ const struct xfs_btree_ops xfs_bnobt_ops = {
	.init_ptr_from_cur	= xfs_allocbt_init_ptr_from_cur,
	.key_diff		= xfs_bnobt_key_diff,
	.buf_ops		= &xfs_bnobt_buf_ops,
	.diff_two_keys		= xfs_bnobt_diff_two_keys,
	.cmp_two_keys		= xfs_bnobt_cmp_two_keys,
	.keys_inorder		= xfs_bnobt_keys_inorder,
	.recs_inorder		= xfs_bnobt_recs_inorder,
	.keys_contiguous	= xfs_allocbt_keys_contiguous,
@@ -470,7 +470,7 @@ const struct xfs_btree_ops xfs_cntbt_ops = {
	.init_ptr_from_cur	= xfs_allocbt_init_ptr_from_cur,
	.key_diff		= xfs_cntbt_key_diff,
	.buf_ops		= &xfs_cntbt_buf_ops,
	.diff_two_keys		= xfs_cntbt_diff_two_keys,
	.cmp_two_keys		= xfs_cntbt_cmp_two_keys,
	.keys_inorder		= xfs_cntbt_keys_inorder,
	.recs_inorder		= xfs_cntbt_recs_inorder,
	.keys_contiguous	= NULL, /* not needed right now */
+2 −2
Original line number Diff line number Diff line
@@ -379,7 +379,7 @@ xfs_bmbt_key_diff(
}

STATIC int64_t
xfs_bmbt_diff_two_keys(
xfs_bmbt_cmp_two_keys(
	struct xfs_btree_cur		*cur,
	const union xfs_btree_key	*k1,
	const union xfs_btree_key	*k2,
@@ -648,7 +648,7 @@ const struct xfs_btree_ops xfs_bmbt_ops = {
	.init_high_key_from_rec	= xfs_bmbt_init_high_key_from_rec,
	.init_rec_from_cur	= xfs_bmbt_init_rec_from_cur,
	.key_diff		= xfs_bmbt_key_diff,
	.diff_two_keys		= xfs_bmbt_diff_two_keys,
	.cmp_two_keys		= xfs_bmbt_cmp_two_keys,
	.buf_ops		= &xfs_bmbt_buf_ops,
	.keys_inorder		= xfs_bmbt_keys_inorder,
	.recs_inorder		= xfs_bmbt_recs_inorder,
+1 −1
Original line number Diff line number Diff line
@@ -5058,7 +5058,7 @@ xfs_btree_simple_query_range(
	int				error;

	ASSERT(cur->bc_ops->init_high_key_from_rec);
	ASSERT(cur->bc_ops->diff_two_keys);
	ASSERT(cur->bc_ops->cmp_two_keys);

	/*
	 * Find the leftmost record.  The btree cursor must be set
+13 −13
Original line number Diff line number Diff line
@@ -176,12 +176,12 @@ struct xfs_btree_ops {
			    const union xfs_btree_key *key);

	/*
	 * Difference between key2 and key1 -- positive if key1 > key2,
	 * negative if key1 < key2, and zero if equal.  If the @mask parameter
	 * is non NULL, each key field to be used in the comparison must
	 * contain a nonzero value.
	 * Compare key1 and key2 -- positive if key1 > key2, negative if
	 * key1 < key2, and zero if equal.  If the @mask parameter is non NULL,
	 * each key field to be used in the comparison must contain a nonzero
	 * value.
	 */
	int64_t (*diff_two_keys)(struct xfs_btree_cur *cur,
	int64_t (*cmp_two_keys)(struct xfs_btree_cur *cur,
				const union xfs_btree_key *key1,
				const union xfs_btree_key *key2,
				const union xfs_btree_key *mask);
@@ -546,7 +546,7 @@ xfs_btree_keycmp_lt(
	const union xfs_btree_key	*key1,
	const union xfs_btree_key	*key2)
{
	return cur->bc_ops->diff_two_keys(cur, key1, key2, NULL) < 0;
	return cur->bc_ops->cmp_two_keys(cur, key1, key2, NULL) < 0;
}

static inline bool
@@ -555,7 +555,7 @@ xfs_btree_keycmp_gt(
	const union xfs_btree_key	*key1,
	const union xfs_btree_key	*key2)
{
	return cur->bc_ops->diff_two_keys(cur, key1, key2, NULL) > 0;
	return cur->bc_ops->cmp_two_keys(cur, key1, key2, NULL) > 0;
}

static inline bool
@@ -564,7 +564,7 @@ xfs_btree_keycmp_eq(
	const union xfs_btree_key	*key1,
	const union xfs_btree_key	*key2)
{
	return cur->bc_ops->diff_two_keys(cur, key1, key2, NULL) == 0;
	return cur->bc_ops->cmp_two_keys(cur, key1, key2, NULL) == 0;
}

static inline bool
@@ -602,7 +602,7 @@ xfs_btree_masked_keycmp_lt(
	const union xfs_btree_key	*key2,
	const union xfs_btree_key	*mask)
{
	return cur->bc_ops->diff_two_keys(cur, key1, key2, mask) < 0;
	return cur->bc_ops->cmp_two_keys(cur, key1, key2, mask) < 0;
}

static inline bool
@@ -612,7 +612,7 @@ xfs_btree_masked_keycmp_gt(
	const union xfs_btree_key	*key2,
	const union xfs_btree_key	*mask)
{
	return cur->bc_ops->diff_two_keys(cur, key1, key2, mask) > 0;
	return cur->bc_ops->cmp_two_keys(cur, key1, key2, mask) > 0;
}

static inline bool
+3 −3
Original line number Diff line number Diff line
@@ -275,7 +275,7 @@ xfs_inobt_key_diff(
}

STATIC int64_t
xfs_inobt_diff_two_keys(
xfs_inobt_cmp_two_keys(
	struct xfs_btree_cur		*cur,
	const union xfs_btree_key	*k1,
	const union xfs_btree_key	*k2,
@@ -432,7 +432,7 @@ const struct xfs_btree_ops xfs_inobt_ops = {
	.init_ptr_from_cur	= xfs_inobt_init_ptr_from_cur,
	.key_diff		= xfs_inobt_key_diff,
	.buf_ops		= &xfs_inobt_buf_ops,
	.diff_two_keys		= xfs_inobt_diff_two_keys,
	.cmp_two_keys		= xfs_inobt_cmp_two_keys,
	.keys_inorder		= xfs_inobt_keys_inorder,
	.recs_inorder		= xfs_inobt_recs_inorder,
	.keys_contiguous	= xfs_inobt_keys_contiguous,
@@ -462,7 +462,7 @@ const struct xfs_btree_ops xfs_finobt_ops = {
	.init_ptr_from_cur	= xfs_finobt_init_ptr_from_cur,
	.key_diff		= xfs_inobt_key_diff,
	.buf_ops		= &xfs_finobt_buf_ops,
	.diff_two_keys		= xfs_inobt_diff_two_keys,
	.cmp_two_keys		= xfs_inobt_cmp_two_keys,
	.keys_inorder		= xfs_inobt_keys_inorder,
	.recs_inorder		= xfs_inobt_recs_inorder,
	.keys_contiguous	= xfs_inobt_keys_contiguous,
Loading