aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/print-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/print-tree.c')
-rw-r--r--fs/btrfs/print-tree.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index aa2d3fac8804..c8ee938c1251 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -17,7 +17,6 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
17 printk("leaf %Lu total ptrs %d free space %d\n", 17 printk("leaf %Lu total ptrs %d free space %d\n",
18 btrfs_header_blocknr(&l->header), nr, 18 btrfs_header_blocknr(&l->header), nr,
19 btrfs_leaf_free_space(root, l)); 19 btrfs_leaf_free_space(root, l));
20 fflush(stdout);
21 for (i = 0 ; i < nr ; i++) { 20 for (i = 0 ; i < nr ; i++) {
22 item = l->items + i; 21 item = l->items + i;
23 type = btrfs_disk_key_type(&item->key); 22 type = btrfs_disk_key_type(&item->key);
@@ -67,10 +66,10 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
67 btrfs_leaf_data(l) + btrfs_item_offset(item)); 66 btrfs_leaf_data(l) + btrfs_item_offset(item));
68 break; 67 break;
69 }; 68 };
70 fflush(stdout);
71 } 69 }
72} 70}
73void btrfs_print_tree(struct btrfs_root *root, struct btrfs_buffer *t) 71
72void btrfs_print_tree(struct btrfs_root *root, struct buffer_head *t)
74{ 73{
75 int i; 74 int i;
76 u32 nr; 75 u32 nr;
@@ -78,16 +77,16 @@ void btrfs_print_tree(struct btrfs_root *root, struct btrfs_buffer *t)
78 77
79 if (!t) 78 if (!t)
80 return; 79 return;
81 c = &t->node; 80 c = btrfs_buffer_node(t);
82 nr = btrfs_header_nritems(&c->header); 81 nr = btrfs_header_nritems(&c->header);
83 if (btrfs_is_leaf(c)) { 82 if (btrfs_is_leaf(c)) {
84 btrfs_print_leaf(root, (struct btrfs_leaf *)c); 83 btrfs_print_leaf(root, (struct btrfs_leaf *)c);
85 return; 84 return;
86 } 85 }
87 printk("node %Lu level %d total ptrs %d free spc %u\n", t->blocknr, 86 printk("node %Lu level %d total ptrs %d free spc %u\n",
88 btrfs_header_level(&c->header), nr, 87 btrfs_header_blocknr(&c->header),
89 (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr); 88 btrfs_header_level(&c->header), nr,
90 fflush(stdout); 89 (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr);
91 for (i = 0; i < nr; i++) { 90 for (i = 0; i < nr; i++) {
92 printk("\tkey %d (%Lu %u %Lu) block %Lu\n", 91 printk("\tkey %d (%Lu %u %Lu) block %Lu\n",
93 i, 92 i,
@@ -95,12 +94,11 @@ void btrfs_print_tree(struct btrfs_root *root, struct btrfs_buffer *t)
95 c->ptrs[i].key.flags, 94 c->ptrs[i].key.flags,
96 c->ptrs[i].key.offset, 95 c->ptrs[i].key.offset,
97 btrfs_node_blockptr(c, i)); 96 btrfs_node_blockptr(c, i));
98 fflush(stdout);
99 } 97 }
100 for (i = 0; i < nr; i++) { 98 for (i = 0; i < nr; i++) {
101 struct btrfs_buffer *next_buf = read_tree_block(root, 99 struct buffer_head *next_buf = read_tree_block(root,
102 btrfs_node_blockptr(c, i)); 100 btrfs_node_blockptr(c, i));
103 struct btrfs_node *next = &next_buf->node; 101 struct btrfs_node *next = btrfs_buffer_node(next_buf);
104 if (btrfs_is_leaf(next) && 102 if (btrfs_is_leaf(next) &&
105 btrfs_header_level(&c->header) != 1) 103 btrfs_header_level(&c->header) != 1)
106 BUG(); 104 BUG();