From patchwork Fri Jun 24 05:39:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Tao X-Patchwork-Id: 9196667 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 D2C1E60754 for ; Fri, 24 Jun 2016 05:45:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C499628491 for ; Fri, 24 Jun 2016 05:45:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B901628493; Fri, 24 Jun 2016 05:45:47 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from oss.sgi.com (oss.sgi.com [192.48.182.195]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1E36628491 for ; Fri, 24 Jun 2016 05:45:46 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id 8BB237CA1; Fri, 24 Jun 2016 00:45:45 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay3.corp.sgi.com [198.149.34.15]) by oss.sgi.com (Postfix) with ESMTP id 99A327CA0 for ; Fri, 24 Jun 2016 00:45:43 -0500 (CDT) Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11]) by relay3.corp.sgi.com (Postfix) with ESMTP id F3B5EAC006 for ; Thu, 23 Jun 2016 22:45:39 -0700 (PDT) X-ASG-Debug-ID: 1466747134-04bdf074b53c4a0001-NocioJ Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [58.251.152.64]) by cuda.sgi.com with ESMTP id jkH8lZgn3kkeNfLs (version=TLSv1 cipher=RC4-SHA bits=128 verify=NO) for ; Thu, 23 Jun 2016 22:45:36 -0700 (PDT) X-Barracuda-Envelope-From: houtao1@huawei.com X-Barracuda-Effective-Source-IP: szxga01-in.huawei.com[58.251.152.64] X-Barracuda-Apparent-Source-IP: 58.251.152.64 Received: from 172.24.1.60 (EHLO szxeml426-hub.china.huawei.com) ([172.24.1.60]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DMR44898; Fri, 24 Jun 2016 13:45:32 +0800 (CST) Received: from huawei.com (10.175.124.28) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.235.1; Fri, 24 Jun 2016 13:45:23 +0800 From: Hou Tao To: Subject: [PATCH] xfs: simplify the calculation of tpp at xfs_bmdr_to_bmbt Date: Fri, 24 Jun 2016 13:39:20 +0800 X-ASG-Orig-Subj: [PATCH] xfs: simplify the calculation of tpp at xfs_bmdr_to_bmbt Message-ID: <1466746760-155962-1-git-send-email-houtao1@huawei.com> X-Mailer: git-send-email 2.5.5 MIME-Version: 1.0 X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.576CC8FD.005A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e73e35560a214329a83deff3932eacca X-Barracuda-Connect: szxga01-in.huawei.com[58.251.152.64] X-Barracuda-Start-Time: 1466747136 X-Barracuda-Encrypted: RC4-SHA X-Barracuda-URL: https://192.48.157.11:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 2328 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.7 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.30713 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Cc: miaoxie@huawei.com, fangwei1@huawei.com X-BeenThere: xfs@oss.sgi.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com X-Virus-Scanned: ClamAV using ClamSMTP remove the usage of rblocklen at xfs_bmdr_to_bmbt, and use be16_to_cpu(dblock->bb_numrecs) instead. It also reduces an extra calculation. Signed-off-by: Hou Tao --- fs/xfs/libxfs/xfs_bmap_btree.c | 5 ++--- fs/xfs/libxfs/xfs_bmap_btree.h | 2 +- fs/xfs/libxfs/xfs_inode_fork.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c index 6282f6e..452cad9 100644 --- a/fs/xfs/libxfs/xfs_bmap_btree.c +++ b/fs/xfs/libxfs/xfs_bmap_btree.c @@ -59,8 +59,7 @@ xfs_bmdr_to_bmbt( struct xfs_inode *ip, xfs_bmdr_block_t *dblock, int dblocklen, - struct xfs_btree_block *rblock, - int rblocklen) + struct xfs_btree_block *rblock) { struct xfs_mount *mp = ip->i_mount; int dmxr; @@ -85,8 +84,8 @@ xfs_bmdr_to_bmbt( fkp = XFS_BMDR_KEY_ADDR(dblock, 1); tkp = XFS_BMBT_KEY_ADDR(mp, rblock, 1); fpp = XFS_BMDR_PTR_ADDR(dblock, 1, dmxr); - tpp = XFS_BMAP_BROOT_PTR_ADDR(mp, rblock, 1, rblocklen); dmxr = be16_to_cpu(dblock->bb_numrecs); + tpp = XFS_BMBT_PTR_ADDR(mp, rblock, 1, dmxr); memcpy(tkp, fkp, sizeof(*fkp) * dmxr); memcpy(tpp, fpp, sizeof(*fpp) * dmxr); } diff --git a/fs/xfs/libxfs/xfs_bmap_btree.h b/fs/xfs/libxfs/xfs_bmap_btree.h index 819a8a4..b1d30f7 100644 --- a/fs/xfs/libxfs/xfs_bmap_btree.h +++ b/fs/xfs/libxfs/xfs_bmap_btree.h @@ -105,7 +105,7 @@ struct xfs_trans; * Prototypes for xfs_bmap.c to call. */ extern void xfs_bmdr_to_bmbt(struct xfs_inode *, xfs_bmdr_block_t *, int, - struct xfs_btree_block *, int); + struct xfs_btree_block *); extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s); extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r); extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r); diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c index bbcc8c7..23967aa 100644 --- a/fs/xfs/libxfs/xfs_inode_fork.c +++ b/fs/xfs/libxfs/xfs_inode_fork.c @@ -433,7 +433,7 @@ xfs_iformat_btree( * to the in-memory structure. */ xfs_bmdr_to_bmbt(ip, dfp, XFS_DFORK_SIZE(dip, ip->i_mount, whichfork), - ifp->if_broot, size); + ifp->if_broot); ifp->if_flags &= ~XFS_IFEXTENTS; ifp->if_flags |= XFS_IFBROOT;