diff options
| author | Fedor Pchelkin <[email protected]> | 2025-07-02 09:39:30 +0000 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2025-07-24 15:30:13 +0000 |
| commit | 3b583adf55c649d5ba37bcd1ca87644b0bc10b86 (patch) | |
| tree | 9cd595ba157367cabd7e3984b2e5cdb134aed23e /fs/xfs/libxfs/xfs_rtrefcount_btree.c | |
| parent | xfs: rename key_diff routines (diff) | |
| download | kernel-3b583adf55c649d5ba37bcd1ca87644b0bc10b86.tar.gz kernel-3b583adf55c649d5ba37bcd1ca87644b0bc10b86.zip | |
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 <[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_rtrefcount_btree.c')
| -rw-r--r-- | fs/xfs/libxfs/xfs_rtrefcount_btree.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/xfs/libxfs/xfs_rtrefcount_btree.c b/fs/xfs/libxfs/xfs_rtrefcount_btree.c index 864c3aa664d7..d9f79ae579c6 100644 --- a/fs/xfs/libxfs/xfs_rtrefcount_btree.c +++ b/fs/xfs/libxfs/xfs_rtrefcount_btree.c @@ -170,7 +170,7 @@ xfs_rtrefcountbt_cmp_key_with_cur( return (int64_t)be32_to_cpu(kp->rc_startblock) - start; } -STATIC int64_t +STATIC int xfs_rtrefcountbt_cmp_two_keys( struct xfs_btree_cur *cur, const union xfs_btree_key *k1, @@ -179,8 +179,8 @@ xfs_rtrefcountbt_cmp_two_keys( { ASSERT(!mask || mask->refc.rc_startblock); - return (int64_t)be32_to_cpu(k1->refc.rc_startblock) - - be32_to_cpu(k2->refc.rc_startblock); + return cmp_int(be32_to_cpu(k1->refc.rc_startblock), + be32_to_cpu(k2->refc.rc_startblock)); } static xfs_failaddr_t |
