From patchwork Tue Mar 14 05:28:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9622509 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 6AF0B60244 for ; Tue, 14 Mar 2017 05:28:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F2F3205AB for ; Tue, 14 Mar 2017 05:28:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53EED284BA; Tue, 14 Mar 2017 05:28:44 +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 F401C205AB for ; Tue, 14 Mar 2017 05:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750803AbdCNF2m (ORCPT ); Tue, 14 Mar 2017 01:28:42 -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 S1750783AbdCNF2l (ORCPT ); Tue, 14 Mar 2017 01:28:41 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="16539527" 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 B7A9648A2968; Tue, 14 Mar 2017 13:28:33 +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:31 +0800 From: Qu Wenruo To: CC: Subject: [PATCH 2/2] btrfs-progs: dump-tree: Also output log root tree Date: Tue, 14 Mar 2017 13:28:28 +0800 Message-ID: <20170314052828.27155-2-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170314052828.27155-1-quwenruo@cn.fujitsu.com> References: <20170314052828.27155-1-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.34] X-yoursite-MailScanner-ID: B7A9648A2968.AECBF 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;