From patchwork Fri Apr 5 00:09:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10886689 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A09017E9 for ; Fri, 5 Apr 2019 00:11:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F8B3288F3 for ; Fri, 5 Apr 2019 00:11:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71F8A28986; Fri, 5 Apr 2019 00:11:34 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 18917288F3 for ; Fri, 5 Apr 2019 00:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729423AbfDEALd (ORCPT ); Thu, 4 Apr 2019 20:11:33 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:35314 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727051AbfDEALd (ORCPT ); Thu, 4 Apr 2019 20:11:33 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x35083wW081904; Fri, 5 Apr 2019 00:11:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=QYAKSeyGlijJUV6HYhgTjGb4GhRrS8Ra3KmOjMDMRBw=; b=NOVwEqHSHbYxKpkV6HhsZ9Ys0Y7EK3DUujmE9GPyYa+wvuqCZAUxxztnea3Y/H/E1f09 vQsgu6IkhKepZWGEdC6ifEhL1nZHvUOi/LardCxOPwkEI6meeVMb7OH8qNwyHTgmPx0b yWVewKvQXuqeMNhKXe2u8w4RrLUaDdVlsWYN1dLY/249Bx2xxkpf+QY4fukywaw2Li9+ TqSaWjq3S62o0MVhFuRzkWeZl0p3VIWPtJ4lYpo79cxttX2/XZgeuq5c6aeEKDJWSdGd 8qi5UtutO5Lsg0BT2xb1KGHTjp7nFioWWJpqfmHl6wQuaG6imLTsQ7aL+oLfouhlpxrH Kw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2rhwydj9gx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Apr 2019 00:11:29 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3509P8r031431; Fri, 5 Apr 2019 00:09:29 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2rm9mjwsxk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Apr 2019 00:09:29 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3509SxW008838; Fri, 5 Apr 2019 00:09:28 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 04 Apr 2019 17:09:27 -0700 Date: Thu, 4 Apr 2019 17:09:24 -0700 From: "Darrick J. Wong" To: sandeen@sandeen.net Cc: linux-xfs@vger.kernel.org Subject: [PATCH v2 43/36] xfs_db: refactor multi-fsb object detection decision making Message-ID: <20190405000924.GW5147@magnolia> References: <155259742281.31886.17157720770696604377.stgit@magnolia> <20190320193721.GG1183@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190320193721.GG1183@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9217 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040155 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9217 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040155 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 Pull the "is this a multi-fsb object" decision into a separate function that we can keep close to the actual multi-fsb object dispatcher. We will soon make the machinery more complex so we do this to avoid having a big hairy if statement. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- db/metadump.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index 83a257d0..23ecf3b7 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -1979,6 +1979,16 @@ process_multi_fsb_dir( return ret; } +static bool +is_multi_fsb_object( + struct xfs_mount *mp, + typnm_t btype) +{ + if (btype == TYP_DIR2 && mp->m_dir_geo->fsbcount > 1) + return true; + return false; +} + static int process_multi_fsb_objects( xfs_fileoff_t o, @@ -2011,6 +2021,7 @@ process_bmbt_reclist( xfs_fileoff_t last; xfs_agnumber_t agno; xfs_agblock_t agbno; + bool is_multi_fsb = is_multi_fsb_object(mp, btype); int error; if (btype == TYP_DATA) @@ -2074,11 +2085,12 @@ process_bmbt_reclist( } /* multi-extent blocks require special handling */ - if (btype != TYP_DIR2 || mp->m_dir_geo->fsbcount == 1) { - error = process_single_fsb_objects(o, s, c, btype, last); - } else { - error = process_multi_fsb_objects(o, s, c, btype, last); - } + if (is_multi_fsb) + error = process_multi_fsb_objects(o, s, c, btype, + last); + else + error = process_single_fsb_objects(o, s, c, btype, + last); if (error) return 0; }