From patchwork Thu May 18 03:38:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9732415 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 ABE116020B for ; Thu, 18 May 2017 03:39:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D12428797 for ; Thu, 18 May 2017 03:39:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81FBC28800; Thu, 18 May 2017 03:39: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=-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 33D9028797 for ; Thu, 18 May 2017 03:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932196AbdERDjX (ORCPT ); Wed, 17 May 2017 23:39:23 -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 S932161AbdERDjV (ORCPT ); Wed, 17 May 2017 23:39:21 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="18996755" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 18 May 2017 11:39:10 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 80C8C47C6528; Thu, 18 May 2017 11:39:06 +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:05 +0800 From: Qu Wenruo To: , Subject: [PATCH 11/32] btrfs-progs: Refactor nodesize users in image/main.c Date: Thu, 18 May 2017 11:38:36 +0800 Message-ID: <20170518033857.15002-12-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: 80C8C47C6528.AF0EF 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 --- image/main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/image/main.c b/image/main.c index f1c28de1..6a4ccfaf 100644 --- a/image/main.c +++ b/image/main.c @@ -919,7 +919,7 @@ static int flush_pending(struct metadump_struct *md, int done) { struct async_work *async = NULL; struct extent_buffer *eb; - u64 blocksize = md->root->nodesize; + u64 blocksize = md->root->fs_info->nodesize; u64 start = 0; u64 size; size_t offset; @@ -1083,7 +1083,8 @@ static int copy_tree_blocks(struct btrfs_root *root, struct extent_buffer *eb, int i = 0; int ret; - ret = add_extent(btrfs_header_bytenr(eb), root->nodesize, metadump, 0); + ret = add_extent(btrfs_header_bytenr(eb), root->fs_info->nodesize, + metadump, 0); if (ret) { error("unable to add metadata block %llu: %d", btrfs_header_bytenr(eb), ret); @@ -1102,7 +1103,8 @@ static int copy_tree_blocks(struct btrfs_root *root, struct extent_buffer *eb, continue; ri = btrfs_item_ptr(eb, i, struct btrfs_root_item); bytenr = btrfs_disk_root_bytenr(eb, ri); - tmp = read_tree_block(root, bytenr, root->nodesize, 0); + tmp = read_tree_block(root, bytenr, + root->fs_info->nodesize, 0); if (!extent_buffer_uptodate(tmp)) { error("unable to read log root block"); return -EIO; @@ -1113,7 +1115,8 @@ static int copy_tree_blocks(struct btrfs_root *root, struct extent_buffer *eb, return ret; } else { bytenr = btrfs_node_blockptr(eb, i); - tmp = read_tree_block(root, bytenr, root->nodesize, 0); + tmp = read_tree_block(root, bytenr, + root->fs_info->nodesize, 0); if (!extent_buffer_uptodate(tmp)) { error("unable to read log root block"); return -EIO; @@ -1260,7 +1263,7 @@ static int copy_from_extent_tree(struct metadump_struct *metadump, bytenr = key.objectid; if (key.type == BTRFS_METADATA_ITEM_KEY) { - num_bytes = extent_root->nodesize; + num_bytes = extent_root->fs_info->nodesize; } else { num_bytes = key.offset; }