From patchwork Fri Jun 2 19:51:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 9763325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6E66E60360 for ; Fri, 2 Jun 2017 19:51:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FB6C285BD for ; Fri, 2 Jun 2017 19:51:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5382D285C1; Fri, 2 Jun 2017 19:51:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9900285BD for ; Fri, 2 Jun 2017 19:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751291AbdFBTvn (ORCPT ); Fri, 2 Jun 2017 15:51:43 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:31196 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135AbdFBTvn (ORCPT ); Fri, 2 Jun 2017 15:51:43 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v52JpeID022181 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 2 Jun 2017 19:51:41 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v52Jpe0j004100 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 2 Jun 2017 19:51:40 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v52Jpe7o005216; Fri, 2 Jun 2017 19:51:40 GMT Received: from localhost (/10.145.179.24) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 02 Jun 2017 12:51:39 -0700 Subject: [PATCH 04/10] xfs_repair: replace rmap_compare with libxfs version From: "Darrick J. Wong" To: sandeen@redhat.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Fri, 02 Jun 2017 12:51:39 -0700 Message-ID: <149643309903.15899.5862825605175613525.stgit@birch.djwong.org> In-Reply-To: <149643307433.15899.922559884171553380.stgit@birch.djwong.org> References: <149643307433.15899.922559884171553380.stgit@birch.djwong.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Now that libxfs has a function to compare rmaps, replace xfs_repair's helper function with that. Signed-off-by: Darrick J. Wong reviewed-by: Eric Sandeen --- libxfs/libxfs_api_defs.h | 1 + repair/rmap.c | 32 ++------------------------------ 2 files changed, 3 insertions(+), 30 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); } /*