From patchwork Thu May 18 03:38:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9732403 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 86F35602C8 for ; Thu, 18 May 2017 03:39:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85E8328801 for ; Thu, 18 May 2017 03:39:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7ACDD28804; Thu, 18 May 2017 03:39:11 +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 1E32928801 for ; Thu, 18 May 2017 03:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755097AbdERDjI (ORCPT ); Wed, 17 May 2017 23:39:08 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:22220 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755042AbdERDjH (ORCPT ); Wed, 17 May 2017 23:39:07 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="18996742" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 18 May 2017 11:39:04 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 31EC347C6528; Thu, 18 May 2017 11:39:01 +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:00 +0800 From: Qu Wenruo To: , Subject: [PATCH 02/32] btrfs-progs: Introduce sectorsize nodesize and stripesize members for btrfs_fs_info Date: Thu, 18 May 2017 11:38:27 +0800 Message-ID: <20170518033857.15002-3-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: 31EC347C6528.AE63A 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 Just like what we do in kernel, since we will not support different leaf/node/stripe size per tree, there is no need to store these block sizes in btrfs_root. This patch will introduce these block size members into btrfs_fs_info structure, allowing us to convert such usage in later patches. Signed-off-by: Qu Wenruo --- chunk-recover.c | 3 +++ ctree.h | 4 ++++ disk-io.c | 3 +++ 3 files changed, 10 insertions(+) diff --git a/chunk-recover.c b/chunk-recover.c index cf8b3184..1a880038 100644 --- a/chunk-recover.c +++ b/chunk-recover.c @@ -1475,6 +1475,9 @@ open_ctree_with_broken_chunk(struct recover_control *rc) } memcpy(fs_info->fsid, &disk_super->fsid, BTRFS_FSID_SIZE); + fs_info->sectorsize = btrfs_super_sectorsize(disk_super); + fs_info->nodesize = btrfs_super_nodesize(disk_super); + fs_info->stripesize = btrfs_super_stripesize(disk_super); ret = btrfs_check_fs_compatibility(disk_super, OPEN_CTREE_WRITES); if (ret) diff --git a/ctree.h b/ctree.h index c457a8dc..78956a4f 100644 --- a/ctree.h +++ b/ctree.h @@ -1147,6 +1147,10 @@ struct btrfs_fs_info { struct cache_tree *fsck_extent_cache; struct cache_tree *corrupt_blocks; + /* Cached block sizes */ + u32 nodesize; + u32 sectorsize; + u32 stripesize; }; /* diff --git a/disk-io.c b/disk-io.c index 838d5cd4..bfdac5ab 100644 --- a/disk-io.c +++ b/disk-io.c @@ -1327,6 +1327,9 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path, } memcpy(fs_info->fsid, &disk_super->fsid, BTRFS_FSID_SIZE); + fs_info->sectorsize = btrfs_super_sectorsize(disk_super); + fs_info->nodesize = btrfs_super_nodesize(disk_super); + fs_info->stripesize = btrfs_super_stripesize(disk_super); ret = btrfs_check_fs_compatibility(fs_info->super_copy, flags); if (ret)