diff options
Diffstat (limited to 'fs/btrfs/print-tree.c')
-rw-r--r-- | fs/btrfs/print-tree.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index 101278e1139a..c95c85640aa9 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
@@ -5,14 +5,14 @@ | |||
5 | #include "ctree.h" | 5 | #include "ctree.h" |
6 | #include "disk-io.h" | 6 | #include "disk-io.h" |
7 | 7 | ||
8 | void print_leaf(struct leaf *l) | 8 | void btrfs_print_leaf(struct btrfs_leaf *l) |
9 | { | 9 | { |
10 | int i; | 10 | int i; |
11 | u32 nr = btrfs_header_nritems(&l->header); | 11 | u32 nr = btrfs_header_nritems(&l->header); |
12 | struct btrfs_item *item; | 12 | struct btrfs_item *item; |
13 | struct extent_item *ei; | 13 | struct btrfs_extent_item *ei; |
14 | printf("leaf %Lu total ptrs %d free space %d\n", | 14 | printf("leaf %Lu total ptrs %d free space %d\n", |
15 | btrfs_header_blocknr(&l->header), nr, leaf_free_space(l)); | 15 | btrfs_header_blocknr(&l->header), nr, btrfs_leaf_free_space(l)); |
16 | fflush(stdout); | 16 | fflush(stdout); |
17 | for (i = 0 ; i < nr ; i++) { | 17 | for (i = 0 ; i < nr ; i++) { |
18 | item = l->items + i; | 18 | item = l->items + i; |
@@ -26,24 +26,25 @@ void print_leaf(struct leaf *l) | |||
26 | fflush(stdout); | 26 | fflush(stdout); |
27 | printf("\t\titem data %.*s\n", btrfs_item_size(item), | 27 | printf("\t\titem data %.*s\n", btrfs_item_size(item), |
28 | l->data + btrfs_item_offset(item)); | 28 | l->data + btrfs_item_offset(item)); |
29 | ei = (struct extent_item *)(l->data + btrfs_item_offset(item)); | 29 | ei = (struct btrfs_extent_item *)(l->data + |
30 | btrfs_item_offset(item)); | ||
30 | printf("\t\textent data refs %u owner %Lu\n", ei->refs, | 31 | printf("\t\textent data refs %u owner %Lu\n", ei->refs, |
31 | ei->owner); | 32 | ei->owner); |
32 | fflush(stdout); | 33 | fflush(stdout); |
33 | } | 34 | } |
34 | } | 35 | } |
35 | void print_tree(struct ctree_root *root, struct tree_buffer *t) | 36 | void btrfs_print_tree(struct btrfs_root *root, struct btrfs_buffer *t) |
36 | { | 37 | { |
37 | int i; | 38 | int i; |
38 | u32 nr; | 39 | u32 nr; |
39 | struct node *c; | 40 | struct btrfs_node *c; |
40 | 41 | ||
41 | if (!t) | 42 | if (!t) |
42 | return; | 43 | return; |
43 | c = &t->node; | 44 | c = &t->node; |
44 | nr = btrfs_header_nritems(&c->header); | 45 | nr = btrfs_header_nritems(&c->header); |
45 | if (btrfs_is_leaf(c)) { | 46 | if (btrfs_is_leaf(c)) { |
46 | print_leaf((struct leaf *)c); | 47 | btrfs_print_leaf((struct btrfs_leaf *)c); |
47 | return; | 48 | return; |
48 | } | 49 | } |
49 | printf("node %Lu level %d total ptrs %d free spc %u\n", t->blocknr, | 50 | printf("node %Lu level %d total ptrs %d free spc %u\n", t->blocknr, |
@@ -58,17 +59,17 @@ void print_tree(struct ctree_root *root, struct tree_buffer *t) | |||
58 | fflush(stdout); | 59 | fflush(stdout); |
59 | } | 60 | } |
60 | for (i = 0; i < nr; i++) { | 61 | for (i = 0; i < nr; i++) { |
61 | struct tree_buffer *next_buf = read_tree_block(root, | 62 | struct btrfs_buffer *next_buf = read_tree_block(root, |
62 | btrfs_node_blockptr(c, i)); | 63 | btrfs_node_blockptr(c, i)); |
63 | struct node *next = &next_buf->node; | 64 | struct btrfs_node *next = &next_buf->node; |
64 | if (btrfs_is_leaf(next) && | 65 | if (btrfs_is_leaf(next) && |
65 | btrfs_header_level(&c->header) != 1) | 66 | btrfs_header_level(&c->header) != 1) |
66 | BUG(); | 67 | BUG(); |
67 | if (btrfs_header_level(&next->header) != | 68 | if (btrfs_header_level(&next->header) != |
68 | btrfs_header_level(&c->header) - 1) | 69 | btrfs_header_level(&c->header) - 1) |
69 | BUG(); | 70 | BUG(); |
70 | print_tree(root, next_buf); | 71 | btrfs_print_tree(root, next_buf); |
71 | tree_block_release(root, next_buf); | 72 | btrfs_block_release(root, next_buf); |
72 | } | 73 | } |
73 | 74 | ||
74 | } | 75 | } |