From patchwork Tue Jun 13 09:19:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9783433 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 31AE0602DC for ; Tue, 13 Jun 2017 09:21:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27DD827FA6 for ; Tue, 13 Jun 2017 09:21:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C85B28640; Tue, 13 Jun 2017 09:21:16 +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 61AA428591 for ; Tue, 13 Jun 2017 09:21:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752767AbdFMJVI (ORCPT ); Tue, 13 Jun 2017 05:21:08 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:17180 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752552AbdFMJTs (ORCPT ); Tue, 13 Jun 2017 05:19:48 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="19973454" 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 58E9A46B53F2; 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:41 +0800 From: Qu Wenruo To: CC: Subject: [PATCH 03/19] btrfs-progs: Refactor btrfs_next_bg and its callers to use btrfs_fs_info Date: Tue, 13 Jun 2017 17:19:19 +0800 Message-ID: <20170613091935.23277-4-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: 58E9A46B53F2.A0709 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 --- find-root.c | 4 ++-- volumes.c | 5 +++-- volumes.h | 14 +++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/find-root.c b/find-root.c index 1b41b217..1765adf8 100644 --- a/find-root.c +++ b/find-root.c @@ -118,11 +118,11 @@ int btrfs_find_root_search(struct btrfs_fs_info *fs_info, fs_info->suppress_check_block_errors = 1; while (1) { if (filter->objectid != BTRFS_CHUNK_TREE_OBJECTID) - ret = btrfs_next_bg_metadata(&fs_info->mapping_tree, + ret = btrfs_next_bg_metadata(fs_info, &chunk_offset, &chunk_size); else - ret = btrfs_next_bg_system(&fs_info->mapping_tree, + ret = btrfs_next_bg_system(fs_info, &chunk_offset, &chunk_size); if (ret) { diff --git a/volumes.c b/volumes.c index 89e39e43..700def64 100644 --- a/volumes.c +++ b/volumes.c @@ -1252,9 +1252,10 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len) return ret; } -int btrfs_next_bg(struct btrfs_mapping_tree *map_tree, u64 *logical, - u64 *size, u64 type) +int btrfs_next_bg(struct btrfs_fs_info *fs_info, u64 *logical, + u64 *size, u64 type) { + struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree; struct cache_extent *ce; struct map_lookup *map; u64 cur = *logical; diff --git a/volumes.h b/volumes.h index 26d88813..6f164e7f 100644 --- a/volumes.h +++ b/volumes.h @@ -187,18 +187,18 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, int rw, u64 logical, u64 *length, struct btrfs_multi_bio **multi_ret, int mirror_num, u64 **raid_map_ret); -int btrfs_next_bg(struct btrfs_mapping_tree *map_tree, u64 *logical, +int btrfs_next_bg(struct btrfs_fs_info *map_tree, u64 *logical, u64 *size, u64 type); -static inline int btrfs_next_bg_metadata(struct btrfs_mapping_tree *map_tree, - u64 *logical, u64 *size) +static inline int btrfs_next_bg_metadata(struct btrfs_fs_info *fs_info, + u64 *logical, u64 *size) { - return btrfs_next_bg(map_tree, logical, size, + return btrfs_next_bg(fs_info, logical, size, BTRFS_BLOCK_GROUP_METADATA); } -static inline int btrfs_next_bg_system(struct btrfs_mapping_tree *map_tree, - u64 *logical, u64 *size) +static inline int btrfs_next_bg_system(struct btrfs_fs_info *fs_info, + u64 *logical, u64 *size) { - return btrfs_next_bg(map_tree, logical, size, + return btrfs_next_bg(fs_info, logical, size, BTRFS_BLOCK_GROUP_SYSTEM); } int btrfs_rmap_block(struct btrfs_fs_info *fs_info,