aboutsummaryrefslogtreecommitdiffstats
path: root/btrfs-debug-tree.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-01-13 16:05:56 +0100
committerDavid Sterba <dsterba@suse.com>2016-01-13 16:43:48 +0100
commit207884898354f6e0a8fd50b16866abf103f46c27 (patch)
tree772a4c06edb128501009780c4a60091cee6e8eef /btrfs-debug-tree.c
parent0aa796cad7ed3fce9d5964646a8f1f5a142b4989 (diff)
downloadbtrfs-progs-207884898354f6e0a8fd50b16866abf103f46c27.tar.gz
btrfs-progs-207884898354f6e0a8fd50b16866abf103f46c27.tar.xz
btrfs-progs-207884898354f6e0a8fd50b16866abf103f46c27.zip
btrfs-progs: debug-tree: teach -t option about the chunk and root trees
A user on IRC wanted to dump the chunk tree using the -t option. As the -t option enumerates only trees pointed by the tree_root, the chunk tree is skipped. Similar for th tree of tree roots. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'btrfs-debug-tree.c')
-rw-r--r--btrfs-debug-tree.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c
index 72dd787..05f9a81 100644
--- a/btrfs-debug-tree.c
+++ b/btrfs-debug-tree.c
@@ -263,6 +263,29 @@ again:
if (!extent_buffer_uptodate(tree_root_scan->node))
goto no_node;
+ /*
+ * Tree's that are not pointed by the tree of tree roots
+ */
+ if (tree_id && tree_id == BTRFS_ROOT_TREE_OBJECTID) {
+ if (!info->tree_root) {
+ error("cannot print root tree, invalid pointer");
+ goto no_node;
+ }
+ printf("root tree\n");
+ btrfs_print_tree(info->tree_root, info->tree_root->node, 1);
+ goto no_node;
+ }
+
+ if (tree_id && tree_id == BTRFS_CHUNK_TREE_OBJECTID) {
+ if (!info->chunk_root) {
+ error("cannot print chunk tree, invalid pointer");
+ goto no_node;
+ }
+ printf("chunk tree\n");
+ btrfs_print_tree(info->chunk_root, info->chunk_root->node, 1);
+ goto no_node;
+ }
+
key.offset = 0;
key.objectid = 0;
btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);