From patchwork Tue Jun 13 09:19:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9783397 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 2167A602DC for ; Tue, 13 Jun 2017 09:19:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1537B285E9 for ; Tue, 13 Jun 2017 09:19:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09643286E7; Tue, 13 Jun 2017 09:19:51 +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 4DB61285E9 for ; Tue, 13 Jun 2017 09:19:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752551AbdFMJTr (ORCPT ); Tue, 13 Jun 2017 05:19:47 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:29819 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752539AbdFMJTp (ORCPT ); Tue, 13 Jun 2017 05:19:45 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="19973448" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 13 Jun 2017 17:19:42 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id E2FF346B53F4; Tue, 13 Jun 2017 17:19:39 +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; Tue, 13 Jun 2017 17:19:42 +0800 From: Qu Wenruo To: CC: Subject: [PATCH 04/19] btrfs-progs: Refactor csum_tree_block to use btrfs_fs_info Date: Tue, 13 Jun 2017 17:19:20 +0800 Message-ID: <20170613091935.23277-5-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170613091935.23277-1-quwenruo@cn.fujitsu.com> References: <20170613091935.23277-1-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.34] X-yoursite-MailScanner-ID: E2FF346B53F4.A0FD9 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 --- disk-io.c | 14 ++++---------- utils.h | 4 ++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/disk-io.c b/disk-io.c index 9d2408c2..bf00e195 100644 --- a/disk-io.c +++ b/disk-io.c @@ -164,8 +164,8 @@ int verify_tree_block_csum_silent(struct extent_buffer *buf, u16 csum_size) return __csum_tree_block_size(buf, csum_size, 1, 1); } -static int csum_tree_block_fs_info(struct btrfs_fs_info *fs_info, - struct extent_buffer *buf, int verify) +int csum_tree_block(struct btrfs_fs_info *fs_info, + struct extent_buffer *buf, int verify) { u16 csum_size = btrfs_super_csum_size(fs_info->super_copy); @@ -174,12 +174,6 @@ static int csum_tree_block_fs_info(struct btrfs_fs_info *fs_info, return csum_tree_block_size(buf, csum_size, verify); } -int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf, - int verify) -{ - return csum_tree_block_fs_info(root->fs_info, buf, verify); -} - struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize) { @@ -345,7 +339,7 @@ struct extent_buffer* read_tree_block( while (1) { ret = read_whole_eb(fs_info, eb, mirror_num); - if (ret == 0 && csum_tree_block_fs_info(fs_info, eb, 1) == 0 && + if (ret == 0 && csum_tree_block(fs_info, eb, 1) == 0 && check_tree_block(fs_info, eb) == 0 && verify_parent_transid(eb->tree, eb, parent_transid, ignore) == 0) { @@ -468,7 +462,7 @@ int write_tree_block(struct btrfs_trans_handle *trans, BUG(); btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN); - csum_tree_block(root, eb, 0); + csum_tree_block(root->fs_info, eb, 0); return write_and_map_eb(root, eb); } diff --git a/utils.h b/utils.h index 24d0a200..bf8eb1ed 100644 --- a/utils.h +++ b/utils.h @@ -115,8 +115,8 @@ u64 btrfs_device_size(int fd, struct stat *st); int get_label_mounted(const char *mount_path, char *labelp); int get_label_unmounted(const char *dev, char *label); int group_profile_max_safe_loss(u64 flags); -int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf, - int verify); +int csum_tree_block(struct btrfs_fs_info *root, struct extent_buffer *buf, + int verify); int ask_user(const char *question); int lookup_path_rootid(int fd, u64 *rootid); int btrfs_scan_devices(void);