From patchwork Thu May 18 03:38:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9732435 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 9BBCE6020B for ; Thu, 18 May 2017 03:39:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CB7F28797 for ; Thu, 18 May 2017 03:39:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 719E328801; Thu, 18 May 2017 03:39:50 +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 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 23B2128797 for ; Thu, 18 May 2017 03:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932244AbdERDjr (ORCPT ); Wed, 17 May 2017 23:39:47 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:46077 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932219AbdERDjd (ORCPT ); Wed, 17 May 2017 23:39:33 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="18996773" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 18 May 2017 11:39:16 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 3FFF247C653B; Thu, 18 May 2017 11:39:13 +0800 (CST) Received: from localhost.localdomain (10.167.226.34) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 18 May 2017 11:39:12 +0800 From: Qu Wenruo To: , Subject: [PATCH 22/32] btrfs-progs: Refactor sectorsize users in file.c Date: Thu, 18 May 2017 11:38:47 +0800 Message-ID: <20170518033857.15002-23-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170518033857.15002-1-quwenruo@cn.fujitsu.com> References: <20170518033857.15002-1-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.34] X-yoursite-MailScanner-ID: 3FFF247C653B.AFBE8 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@cn.fujitsu.com Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Qu Wenruo --- file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/file.c b/file.c index bf31ccef..028bfba8 100644 --- a/file.c +++ b/file.c @@ -193,10 +193,10 @@ int btrfs_read_file(struct btrfs_root *root, u64 ino, u64 start, int len, int read = 0; int ret; - if (!IS_ALIGNED(start, root->sectorsize) || - !IS_ALIGNED(len, root->sectorsize)) { + if (!IS_ALIGNED(start, root->fs_info->sectorsize) || + !IS_ALIGNED(len, root->fs_info->sectorsize)) { warning("@start and @len must be aligned to %u for function %s", - root->sectorsize, __func__); + root->fs_info->sectorsize, __func__); return -EINVAL; } @@ -260,7 +260,7 @@ int btrfs_read_file(struct btrfs_root *root, u64 ino, u64 start, int len, goto next; read_extent_buffer(leaf, dest, btrfs_file_extent_inline_start(fi), extent_len); - read += round_up(extent_len, root->sectorsize); + read += round_up(extent_len, root->fs_info->sectorsize); break; } @@ -319,7 +319,7 @@ next: ii = btrfs_item_ptr(path.nodes[0], path.slots[0], struct btrfs_inode_item); isize = round_up(btrfs_inode_size(path.nodes[0], ii), - root->sectorsize); + root->fs_info->sectorsize); read = min_t(u64, isize - start, len); } out: