From patchwork Tue Mar 14 05:35:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9622515 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 182D760244 for ; Tue, 14 Mar 2017 05:36:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09FC828491 for ; Tue, 14 Mar 2017 05:36:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFAA6284F8; Tue, 14 Mar 2017 05:36:17 +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 7E4F328491 for ; Tue, 14 Mar 2017 05:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750787AbdCNFfZ (ORCPT ); Tue, 14 Mar 2017 01:35:25 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:60821 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750760AbdCNFfY (ORCPT ); Tue, 14 Mar 2017 01:35:24 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="16539742" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 14 Mar 2017 13:35:21 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 54D0948A296B; Tue, 14 Mar 2017 13:35:22 +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:35:20 +0800 From: Qu Wenruo To: CC: Subject: [PATCH v2 2/2] btrfs-progs: dump-tree: Also output log root tree Date: Tue, 14 Mar 2017 13:35:18 +0800 Message-ID: <20170314053518.28812-2-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170314053518.28812-1-quwenruo@cn.fujitsu.com> References: <20170314053518.28812-1-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.34] X-yoursite-MailScanner-ID: 54D0948A296B.AE9D5 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 In btrfs-dump-tree, we output any existing log tree, however we don't output the log root tree, which records all root items for log trees. This makes it confusing for any one who want to know where the log tree comes from. Signed-off-by: Qu Wenruo --- v2: Check if log_root_tree exists before printing it in root_only mode --- cmds-inspect-dump-tree.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c index 2c6bec7f..5a5ca536 100644 --- a/cmds-inspect-dump-tree.c +++ b/cmds-inspect-dump-tree.c @@ -344,6 +344,11 @@ int cmd_inspect_dump_tree(int argc, char **argv) printf("chunk tree: %llu level %d\n", (unsigned long long)info->chunk_root->node->start, btrfs_header_level(info->chunk_root->node)); + if (info->log_root_tree) + printf("log root tree: %llu level %d\n", + info->log_root_tree->node->start, + btrfs_header_level( + info->log_root_tree->node)); } else { if (info->tree_root->node) { printf("root tree\n"); @@ -356,6 +361,12 @@ int cmd_inspect_dump_tree(int argc, char **argv) btrfs_print_tree(info->chunk_root, info->chunk_root->node, 1); } + + if (info->log_root_tree) { + printf("log root tree\n"); + btrfs_print_tree(info->log_root_tree, + info->log_root_tree->node, 1); + } } } tree_root_scan = info->tree_root; @@ -388,6 +399,17 @@ again: goto close_root; } + if (tree_id && tree_id == BTRFS_TREE_LOG_OBJECTID) { + if (!info->log_root_tree) { + error("cannot print log root tree, invalid pointer"); + goto close_root; + } + printf("log root tree\n"); + btrfs_print_tree(info->log_root_tree, info->log_root_tree->node, + 1); + goto close_root; + } + key.offset = 0; key.objectid = 0; key.type = BTRFS_ROOT_ITEM_KEY;