From patchwork Tue Mar 14 05:28: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: 9622507 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 34F0660244 for ; Tue, 14 Mar 2017 05:28:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2713D205AB for ; Tue, 14 Mar 2017 05:28:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17974284BA; Tue, 14 Mar 2017 05:28:43 +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 4DBA3205AB for ; Tue, 14 Mar 2017 05:28:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750793AbdCNF2k (ORCPT ); Tue, 14 Mar 2017 01:28:40 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:65506 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750783AbdCNF2j (ORCPT ); Tue, 14 Mar 2017 01:28:39 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="16539526" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 14 Mar 2017 13:28:36 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id C5E4248A2967; Tue, 14 Mar 2017 13:28:32 +0800 (CST) Received: from localhost.localdomain (10.167.226.34) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 14 Mar 2017 13:28:30 +0800 From: Qu Wenruo To: CC: Subject: [PATCH 1/2] btrfs-progs: dump-tree: Fix duplicated output when using -t option Date: Tue, 14 Mar 2017 13:28:27 +0800 Message-ID: <20170314052828.27155-1-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.12.0 MIME-Version: 1.0 X-Originating-IP: [10.167.226.34] X-yoursite-MailScanner-ID: C5E4248A2967.AE43A 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 When using -t option to output trees not in root tree (chunk/root/log root), then we output the tree twice. Fix it Signed-off-by: Qu Wenruo --- cmds-inspect-dump-tree.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c index 6c6c0e5c..2c6bec7f 100644 --- a/cmds-inspect-dump-tree.c +++ b/cmds-inspect-dump-tree.c @@ -371,21 +371,21 @@ again: if (tree_id && tree_id == BTRFS_ROOT_TREE_OBJECTID) { if (!info->tree_root->node) { error("cannot print root tree, invalid pointer"); - goto no_node; + goto close_root; } printf("root tree\n"); btrfs_print_tree(info->tree_root, info->tree_root->node, 1); - goto no_node; + goto close_root; } if (tree_id && tree_id == BTRFS_CHUNK_TREE_OBJECTID) { if (!info->chunk_root->node) { error("cannot print chunk tree, invalid pointer"); - goto no_node; + goto close_root; } printf("chunk tree\n"); btrfs_print_tree(info->chunk_root, info->chunk_root->node, 1); - goto no_node; + goto close_root; } key.offset = 0;