From patchwork Wed Mar 20 19:37:22 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: 10862535 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 687421390 for ; Wed, 20 Mar 2019 19:37:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B20829E77 for ; Wed, 20 Mar 2019 19:37:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FDFF29C39; Wed, 20 Mar 2019 19:37:25 +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 E160D29C07 for ; Wed, 20 Mar 2019 19:37:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726239AbfCTThY (ORCPT ); Wed, 20 Mar 2019 15:37:24 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:33576 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbfCTThY (ORCPT ); Wed, 20 Mar 2019 15:37:24 -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 x2KJXfk9151362; Wed, 20 Mar 2019 19:37:22 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=mmtIbdcL1q+KMCdH+vKbzbLxlnAhgXsLXLYY0AQjwho=; b=MGJV/D1M8mJyyB5YKU8I19cc0d27IHna9S0tYp6d/hPLf/8jOipaC7sb3VpZUGlj261i 0FdDqNzvucg5MyOHTr2nfe7vBcCtEZxTXvCKzyLwGrTFyBZctl+Crfoe9EqAsXT7gRwl P6FMdcxpgWKPl9AhzlBsfOEFZ5XdHSCpt47YPwZYL0nj3in3rivxWqOrvSrcGTJhrkD1 /BiXoml3VzZ+j7CZyZ5cffOSKxXJ2XItl9g1dicVI4lcqCmDrmHhDu10bDTSowuaPISH 7sv8shVuldV283u5MnB8MzBfgHINydKOkPnMMPstTHXmvbi2zWeUuxe+eSE362lMtIJY YQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2r8pnew3ev-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Mar 2019 19:37:22 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x2KJbLes007113 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Mar 2019 19:37:21 GMT 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 x2KJbLo5001793; Wed, 20 Mar 2019 19:37:21 GMT Received: from localhost (/10.159.247.212) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 20 Mar 2019 12:37:20 -0700 Date: Wed, 20 Mar 2019 12:37:22 -0700 From: "Darrick J. Wong" To: sandeen@sandeen.net Cc: linux-xfs@vger.kernel.org Subject: [PATCH 43/36] xfs_db: refactor multi-fsb object detection decision making Message-ID: <20190320193721.GG1183@magnolia> References: <155259742281.31886.17157720770696604377.stgit@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <155259742281.31886.17157720770696604377.stgit@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9201 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-1903200142 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 --- db/metadump.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/db/metadump.c b/db/metadump.c index 83a257d0..57216291 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,7 +2085,7 @@ process_bmbt_reclist( } /* multi-extent blocks require special handling */ - if (btype != TYP_DIR2 || mp->m_dir_geo->fsbcount == 1) { + if (!is_multi_fsb) { error = process_single_fsb_objects(o, s, c, btype, last); } else { error = process_multi_fsb_objects(o, s, c, btype, last);