[PATCH 13/27] xfs_repair: tidy up rmap_diffkeys

Darrick J. Wong
2025-02-06T22:53:08Z

Tidy up the comparison code in this function to match the kernel.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
repair/rmap.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/repair/rmap.c b/repair/rmap.c
index bd91c721e20e4e..2065bdc0b190ba 100644
--- a/repair/rmap.c
+++ b/repair/rmap.c
@@ -1267,7 +1267,6 @@ rmap_diffkeys(
{
__u64 oa;
__u64 ob;
- int64_t d;
struct xfs_rmap_irec tmp;

tmp = *kp1;
@@ -1277,9 +1276,10 @@ rmap_diffkeys(
tmp.rm_flags &= ~XFS_RMAP_REC_FLAGS;
ob = libxfs_rmap_irec_offset_pack(&tmp);

- d = (int64_t)kp1->rm_startblock - kp2->rm_startblock;
- if (d)
- return d;
+ if (kp1->rm_startblock > kp2->rm_startblock)
+ return 1;
+ else if (kp2->rm_startblock > kp1->rm_startblock)
+ return -1;

if (kp1->rm_owner > kp2->rm_owner)
return 1;