diff mbox

[2/2] btrfs-progs: dump-tree: Also output log root tree

Message ID 20170303041345.11760-2-quwenruo@cn.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Qu Wenruo March 3, 2017, 4:13 a.m. UTC
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 <quwenruo@cn.fujitsu.com>
---
 cmds-inspect-dump-tree.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

David Sterba March 13, 2017, 4:23 p.m. UTC | #1
On Fri, Mar 03, 2017 at 12:13:45PM +0800, Qu Wenruo wrote:
> 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 <quwenruo@cn.fujitsu.com>

What's the base of this patch or is there a patch that I've missed to
apply? This fails on current devel, 4.10, 4.9.1 and I don't see patch
1/2 in my mailbox or on patchwork. Please refresh and resend.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;