From patchwork Fri Mar 3 04:13:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9602133 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 EBFEC604E2 for ; Fri, 3 Mar 2017 07:11:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF72B2861E for ; Fri, 3 Mar 2017 07:11:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD52028624; Fri, 3 Mar 2017 07:11:36 +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 3B3752861E for ; Fri, 3 Mar 2017 07:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751668AbdCCHLL (ORCPT ); Fri, 3 Mar 2017 02:11:11 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:21999 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751907AbdCCHKx (ORCPT ); Fri, 3 Mar 2017 02:10:53 -0500 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="16164503" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 03 Mar 2017 12:13:56 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 326E047D8B72; Fri, 3 Mar 2017 12:13:56 +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; Fri, 3 Mar 2017 12:13:56 +0800 From: Qu Wenruo To: , Subject: [PATCH 2/2] btrfs-progs: dump-tree: Also output log root tree Date: Fri, 3 Mar 2017 12:13:45 +0800 Message-ID: <20170303041345.11760-2-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170303041345.11760-1-quwenruo@cn.fujitsu.com> References: <20170303041345.11760-1-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.34] X-yoursite-MailScanner-ID: 326E047D8B72.AC8F2 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 --- cmds-inspect-dump-tree.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c index 2c6bec7f..eca91b5e 100644 --- a/cmds-inspect-dump-tree.c +++ b/cmds-inspect-dump-tree.c @@ -344,6 +344,9 @@ 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)); + printf("log root tree: %llu level %d\n", + (unsigned long long)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 +359,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 +397,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;