From patchwork Wed Jun 25 10:04:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Hecheng X-Patchwork-Id: 4419061 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B12ACBEEAA for ; Wed, 25 Jun 2014 10:09:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D8CCA20377 for ; Wed, 25 Jun 2014 10:09:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1224B202D1 for ; Wed, 25 Jun 2014 10:09:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755197AbaFYKJj (ORCPT ); Wed, 25 Jun 2014 06:09:39 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:63802 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755081AbaFYKJj (ORCPT ); Wed, 25 Jun 2014 06:09:39 -0400 X-IronPort-AV: E=Sophos;i="5.00,775,1396972800"; d="scan'208";a="32412238" Received: from localhost (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 25 Jun 2014 18:06:56 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s5PA9aYa019246; Wed, 25 Jun 2014 18:09:36 +0800 Received: from localhost.localdomain (10.167.226.111) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Wed, 25 Jun 2014 18:09:44 +0800 From: Gui Hecheng To: CC: , Gui Hecheng Subject: [PATCH] btrfs-progs: replace BTRFS_NUM_MIRRORS with BTRFS_MAX_MIRRORS Date: Wed, 25 Jun 2014 18:04:17 +0800 Message-ID: <1403690657-13521-1-git-send-email-guihc.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 X-Originating-IP: [10.167.226.111] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The chunk-recover.c/BTRFS_NUM_MIRRORS in the userspace means the same thing as ctree.h/BTRFS_MAX_MIRRORS in the kernelspace, so to stay consistent with the kernelspace, just make this movement in the userspace: chunk-recover.c/BTRFS_NUM_MIRRORS ===> ctree.h/BTRFS_MAX_MIRRORS This provides convenience for future use. Signed-off-by: Gui Hecheng --- chunk-recover.c | 8 +++----- ctree.h | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/chunk-recover.c b/chunk-recover.c index 8bc5bc3..b638ada 100644 --- a/chunk-recover.c +++ b/chunk-recover.c @@ -42,8 +42,6 @@ #include "btrfsck.h" #include "commands.h" -#define BTRFS_NUM_MIRRORS 3 - struct recover_control { int verbose; int yes; @@ -71,8 +69,8 @@ struct extent_record { struct cache_extent cache; u64 generation; u8 csum[BTRFS_CSUM_SIZE]; - struct btrfs_device *devices[BTRFS_NUM_MIRRORS]; - u64 offsets[BTRFS_NUM_MIRRORS]; + struct btrfs_device *devices[BTRFS_MAX_MIRRORS]; + u64 offsets[BTRFS_MAX_MIRRORS]; int nmirrors; }; @@ -128,7 +126,7 @@ again: memcmp(exist->csum, rec->csum, BTRFS_CSUM_SIZE)) { ret = -EEXIST; } else { - BUG_ON(exist->nmirrors >= BTRFS_NUM_MIRRORS); + BUG_ON(exist->nmirrors >= BTRFS_MAX_MIRRORS); exist->devices[exist->nmirrors] = device; exist->offsets[exist->nmirrors] = offset; exist->nmirrors++; diff --git a/ctree.h b/ctree.h index 0690063..35d3633 100644 --- a/ctree.h +++ b/ctree.h @@ -40,6 +40,8 @@ struct btrfs_trans_handle; struct btrfs_free_space_ctl; #define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */ +#define BTRFS_MAX_MIRRORS 3 + #define BTRFS_MAX_LEVEL 8 #define BTRFS_COMPAT_EXTENT_TREE_V0