summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_ialloc_btree.c
diff options
context:
space:
mode:
authorFedor Pchelkin <pchelkin@ispras.ru>2025-07-02 12:39:30 +0300
committerCarlos Maiolino <cem@kernel.org>2025-07-24 17:30:13 +0200
commit3b583adf55c649d5ba37bcd1ca87644b0bc10b86 (patch)
tree9cd595ba157367cabd7e3984b2e5cdb134aed23e /fs/xfs/libxfs/xfs_ialloc_btree.c
parent82b63ee160016096436aa026a27c8d85d40f3fb1 (diff)
xfs: refactor cmp_two_keys routines to take advantage of cmp_int()
The net value of these functions is to determine the result of a three-way-comparison between operands of the same type. Simplify the code using cmp_int() to eliminate potential errors with opencoded casts and subtractions. This also means we can change the return value type of cmp_two_keys routines from int64_t to int and make the interface a bit clearer. Found by Linux Verification Center (linuxtesting.org). Suggested-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs/xfs_ialloc_btree.c')
-rw-r--r--fs/xfs/libxfs/xfs_ialloc_btree.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c
index 0d0c6534259a..ab9fce20b083 100644
--- a/fs/xfs/libxfs/xfs_ialloc_btree.c
+++ b/fs/xfs/libxfs/xfs_ialloc_btree.c
@@ -274,7 +274,7 @@ xfs_inobt_cmp_key_with_cur(
cur->bc_rec.i.ir_startino;
}
-STATIC int64_t
+STATIC int
xfs_inobt_cmp_two_keys(
struct xfs_btree_cur *cur,
const union xfs_btree_key *k1,
@@ -283,8 +283,8 @@ xfs_inobt_cmp_two_keys(
{
ASSERT(!mask || mask->inobt.ir_startino);
- return (int64_t)be32_to_cpu(k1->inobt.ir_startino) -
- be32_to_cpu(k2->inobt.ir_startino);
+ return cmp_int(be32_to_cpu(k1->inobt.ir_startino),
+ be32_to_cpu(k2->inobt.ir_startino));
}
static xfs_failaddr_t