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 04/10] xfs_repair: replace rmap_compare with libxfs version
Date: Fri, 02 Jun 2017 12:51:39 -0700	[thread overview]
Message-ID: <149643309903.15899.5862825605175613525.stgit@birch.djwong.org> (raw)
In-Reply-To: <149643307433.15899.922559884171553380.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-06-02 19:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02 19:51 [PATCH v8 00/10] xfsprogs 4.12: GETFSMAP support Darrick J. Wong
2017-06-02 19:51 ` [PATCH 01/10] xfs: introduce the XFS_IOC_GETFSMAP ioctl Darrick J. Wong
2017-06-02 19:51 ` [PATCH 02/10] xfs_io: refactor numlen into a library function Darrick J. Wong
2017-06-13 21:09   ` Eric Sandeen
2017-06-02 19:51 ` [PATCH 03/10] xfs_io: support the new getfsmap ioctl Darrick J. Wong
2017-06-13 22:20   ` Eric Sandeen
2017-06-14  0:23     ` Darrick J. Wong
2017-06-02 19:51 ` Darrick J. Wong [this message]
2017-06-13 22:34   ` [PATCH 04/10] xfs_repair: replace rmap_compare with libxfs version Eric Sandeen
2017-06-02 19:51 ` [PATCH 05/10] xfs_spaceman: space management tool Darrick J. Wong
2017-06-14 14:15   ` Eric Sandeen
2017-06-14 16:16     ` Darrick J. Wong
2017-06-02 19:51 ` [PATCH 06/10] xfs_spaceman: add FITRIM support Darrick J. Wong
2017-06-14 15:32   ` Eric Sandeen
2017-06-14 16:32     ` Darrick J. Wong
2017-06-02 19:51 ` [PATCH 07/10] xfs_spaceman: add new speculative prealloc control Darrick J. Wong
2017-06-14 15:05   ` Eric Sandeen
2017-06-14 16:39     ` Darrick J. Wong
2017-06-02 19:52 ` [PATCH 08/10] xfs_spaceman: Free space mapping command Darrick J. Wong
2017-06-14 15:43   ` Eric Sandeen
2017-06-14 16:43     ` Darrick J. Wong
2017-06-14 16:04   ` Eric Sandeen
2017-06-14 16:57     ` Darrick J. Wong
2017-06-02 19:52 ` [PATCH 09/10] xfs_spaceman: add a man page Darrick J. Wong
2017-06-14 16:06   ` Eric Sandeen
2017-06-14 20:49     ` Darrick J. Wong
2017-06-02 19:52 ` [PATCH 10/10] xfs_spaceman: add group summary mode Darrick J. Wong
2017-06-14 16:23   ` Eric Sandeen
2017-06-14 17:22     ` 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=149643309903.15899.5862825605175613525.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.