All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] btrfs-progs: dump-tree: Fix duplicated output when using -t option
@ 2017-03-14  5:35 Qu Wenruo
  2017-03-14  5:35 ` [PATCH v2 2/2] btrfs-progs: dump-tree: Also output log root tree Qu Wenruo
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2017-03-14  5:35 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

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 <quwenruo@cn.fujitsu.com>
---
v2:
  None
---
 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;
-- 
2.12.0




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] btrfs-progs: dump-tree: Also output log root tree
  2017-03-14  5:35 [PATCH v2 1/2] btrfs-progs: dump-tree: Fix duplicated output when using -t option Qu Wenruo
@ 2017-03-14  5:35 ` Qu Wenruo
  2017-03-16 15:54   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2017-03-14  5:35 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

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>
---
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;
-- 
2.12.0




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 2/2] btrfs-progs: dump-tree: Also output log root tree
  2017-03-14  5:35 ` [PATCH v2 2/2] btrfs-progs: dump-tree: Also output log root tree Qu Wenruo
@ 2017-03-16 15:54   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2017-03-16 15:54 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs, dsterba

On Tue, Mar 14, 2017 at 01:35:18PM +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>
> ---
> v2:
>   Check if log_root_tree exists before printing it in root_only mode

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-16 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-14  5:35 [PATCH v2 1/2] btrfs-progs: dump-tree: Fix duplicated output when using -t option Qu Wenruo
2017-03-14  5:35 ` [PATCH v2 2/2] btrfs-progs: dump-tree: Also output log root tree Qu Wenruo
2017-03-16 15:54   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.