]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: replace rmap_compare with libxfs version
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 21 Jun 2017 22:14:30 +0000 (17:14 -0500)
committerEric Sandeen <sandeen@redhat.com>
Wed, 21 Jun 2017 22:14:30 +0000 (17:14 -0500)
Now that libxfs has a function to compare rmaps, replace xfs_repair's
helper function with that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/libxfs_api_defs.h
repair/rmap.c

index 34716c49cf5cacdc17f6c3102fecc4af8d780619..d299b7a24a6f3697f95b925b92f7fa42ad3bfb37 100644 (file)
 #define xfs_refcount_get_rec           libxfs_refcount_get_rec
 #define xfs_rmap_lookup_le_range       libxfs_rmap_lookup_le_range
 #define xfs_refc_block                 libxfs_refc_block
+#define xfs_rmap_compare               libxfs_rmap_compare
 
 #endif /* __LIBXFS_API_DEFS_H__ */
index 7508973c581c49729a86a30d5519142fc252daf6..ab6e583961b30090f19749a929f357c173fc451b 100644 (file)
@@ -49,37 +49,9 @@ static struct xfs_ag_rmap *ag_rmaps;
 static bool rmapbt_suspect;
 static bool refcbt_suspect;
 
-/*
- * Compare rmap observations for array sorting.
- */
-static int
-rmap_compare(
-       const void              *a,
-       const void              *b)
+static inline int rmap_compare(const void *a, const void *b)
 {
-       const struct xfs_rmap_irec      *pa;
-       const struct xfs_rmap_irec      *pb;
-       __u64                   oa;
-       __u64                   ob;
-
-       pa = a; pb = b;
-       oa = libxfs_rmap_irec_offset_pack(pa);
-       ob = libxfs_rmap_irec_offset_pack(pb);
-
-       if (pa->rm_startblock < pb->rm_startblock)
-               return -1;
-       else if (pa->rm_startblock > pb->rm_startblock)
-               return 1;
-       else if (pa->rm_owner < pb->rm_owner)
-               return -1;
-       else if (pa->rm_owner > pb->rm_owner)
-               return 1;
-       else if (oa < ob)
-               return -1;
-       else if (oa > ob)
-               return 1;
-       else
-               return 0;
+       return libxfs_rmap_compare(a, b);
 }
 
 /*