aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_ialloc_btree.c
diff options
context:
space:
mode:
authorFedor Pchelkin <[email protected]>2025-07-02 09:39:31 +0000
committerCarlos Maiolino <[email protected]>2025-07-24 15:30:13 +0000
commit734b871d6cf7d4f815bb1eff8c808289079701c2 (patch)
tree11d916228cc945bab039b3f789297618b8c93db9 /fs/xfs/libxfs/xfs_ialloc_btree.c
parentxfs: refactor cmp_two_keys routines to take advantage of cmp_int() (diff)
downloadkernel-734b871d6cf7d4f815bb1eff8c808289079701c2.tar.gz
kernel-734b871d6cf7d4f815bb1eff8c808289079701c2.zip
xfs: refactor cmp_key_with_cur 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_key_with_cur 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 <[email protected]> Signed-off-by: Fedor Pchelkin <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
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 ab9fce20b083..100afdd66cdd 100644
--- a/fs/xfs/libxfs/xfs_ialloc_btree.c
+++ b/fs/xfs/libxfs/xfs_ialloc_btree.c
@@ -265,13 +265,13 @@ xfs_finobt_init_ptr_from_cur(
ptr->s = agi->agi_free_root;
}
-STATIC int64_t
+STATIC int
xfs_inobt_cmp_key_with_cur(
struct xfs_btree_cur *cur,
const union xfs_btree_key *key)
{
- return (int64_t)be32_to_cpu(key->inobt.ir_startino) -
- cur->bc_rec.i.ir_startino;
+ return cmp_int(be32_to_cpu(key->inobt.ir_startino),
+ cur->bc_rec.i.ir_startino);
}
STATIC int