All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@redhat.com, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 2/9] xfs_repair: replace rmap_compare with libxfs version
Date: Sun, 07 May 2017 08:56:29 -0700	[thread overview]
Message-ID: <149417258914.24656.9049411771758934739.stgit@birch.djwong.org> (raw)
In-Reply-To: <149417257252.24656.2629280196308754994.stgit@birch.djwong.org>

From: Darrick J. Wong <darrick.wong@oracle.com>

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>
---
 libxfs/libxfs_api_defs.h |    1 +
 repair/rmap.c            |   32 ++------------------------------
 2 files changed, 3 insertions(+), 30 deletions(-)


diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h
index 31239ca..2d8d9c8 100644
--- a/libxfs/libxfs_api_defs.h
+++ b/libxfs/libxfs_api_defs.h
@@ -144,5 +144,6 @@
 #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__ */
diff --git a/repair/rmap.c b/repair/rmap.c
index 7508973..ab6e583 100644
--- a/repair/rmap.c
+++ b/repair/rmap.c
@@ -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);
 }
 
 /*


  parent reply	other threads:[~2017-05-07 21:37 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-07 15:56 [PATCH v7 0/9] xfsprogs 4.12: GETFSMAP support Darrick J. Wong
2017-05-07 15:56 ` [PATCH 1/9] xfs_io: support the new getfsmap ioctl Darrick J. Wong
2017-05-08 21:01   ` Eric Sandeen
2017-05-15 19:18     ` Darrick J. Wong
2017-05-15 19:30       ` Eric Sandeen
2017-05-07 15:56 ` Darrick J. Wong [this message]
2017-05-07 15:56 ` [PATCH 3/9] xfs_spaceman: space management tool Darrick J. Wong
2017-05-27  1:34   ` Eric Sandeen
2017-05-30 17:37     ` Darrick J. Wong
2017-05-30 18:17       ` Eric Sandeen
2017-05-30 18:47         ` Darrick J. Wong
2017-06-02 19:44           ` Darrick J. Wong
2017-05-07 15:56 ` [PATCH 4/9] xfs_spaceman: add FITRIM support Darrick J. Wong
2017-05-27  0:27   ` Eric Sandeen
2017-05-30 18:24     ` Darrick J. Wong
2017-05-07 15:56 ` [PATCH 5/9] xfs_spaceman: add new speculative prealloc control Darrick J. Wong
2017-05-27  1:45   ` Eric Sandeen
2017-05-30 18:34     ` Darrick J. Wong
2017-05-07 15:56 ` [PATCH 6/9] xfs_spaceman: AG state control Darrick J. Wong
2017-05-26 23:06   ` Eric Sandeen
2017-05-30 18:30     ` Darrick J. Wong
2017-05-07 15:57 ` [PATCH 7/9] xfs_spaceman: Free space mapping command Darrick J. Wong
2017-05-27  1:57   ` Eric Sandeen
2017-05-30 18:40     ` Darrick J. Wong
2017-05-30 18:56       ` Eric Sandeen
2017-05-30 19:19         ` Darrick J. Wong
2017-05-07 15:57 ` [PATCH 8/9] xfs_spaceman: add a man page Darrick J. Wong
2017-05-07 15:57 ` [PATCH 9/9] xfs_spaceman: add group summary mode Darrick J. Wong
2017-05-08 19:47 ` [PATCH 0.9/9] xfs: introduce the XFS_IOC_GETFSMAP ioctl Darrick J. Wong
2017-05-10 14:46   ` Eric Sandeen
2017-05-10 17:03     ` Darrick J. Wong
2017-05-12 22:29   ` Eric Sandeen
2017-05-12 23:05     ` Darrick J. Wong
2017-05-12 23:11       ` Eric Sandeen
2017-05-26 21:20   ` Eric Sandeen
2017-05-26 21:41     ` Darrick J. Wong
2017-05-26 22:12       ` Eric Sandeen
2017-05-30 18:44         ` Darrick J. Wong
2017-05-30 18:47           ` Eric Sandeen
2017-05-30 18:59             ` Eric Sandeen
  -- strict thread matches above, loose matches on Subject: below --
2017-03-08  1:14 [PATCH v6 0/9] xfsprogs 4.12: GETFSMAP support Darrick J. Wong
2017-03-08  1:14 ` [PATCH 2/9] xfs_repair: replace rmap_compare with libxfs version Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=149417258914.24656.9049411771758934739.stgit@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.