aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/print-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-14 14:14:43 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-14 14:14:43 -0400
commit123abc88c9087b9c5605566ee3491aaef17fd837 (patch)
tree3a8e83ac7a095d2b875664ee54cf7e24e977999b /fs/btrfs/print-tree.c
parent4beb1b8b75a86373f6020103ab840448d14c8880 (diff)
Btrfs: variable block size support
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/print-tree.c')
-rw-r--r--fs/btrfs/print-tree.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index e769f36cf051..7a189eaa589f 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -5,7 +5,7 @@
5#include "ctree.h" 5#include "ctree.h"
6#include "disk-io.h" 6#include "disk-io.h"
7 7
8void btrfs_print_leaf(struct btrfs_leaf *l) 8void btrfs_print_leaf(struct btrfs_root *root, 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);
@@ -13,7 +13,8 @@ void btrfs_print_leaf(struct btrfs_leaf *l)
13 struct btrfs_extent_item *ei; 13 struct btrfs_extent_item *ei;
14 struct btrfs_root_item *ri; 14 struct btrfs_root_item *ri;
15 printf("leaf %Lu total ptrs %d free space %d\n", 15 printf("leaf %Lu total ptrs %d free space %d\n",
16 btrfs_header_blocknr(&l->header), nr, btrfs_leaf_free_space(l)); 16 btrfs_header_blocknr(&l->header), nr,
17 btrfs_leaf_free_space(root, l));
17 fflush(stdout); 18 fflush(stdout);
18 for (i = 0 ; i < nr ; i++) { 19 for (i = 0 ; i < nr ; i++) {
19 item = l->items + i; 20 item = l->items + i;
@@ -25,7 +26,7 @@ void btrfs_print_leaf(struct btrfs_leaf *l)
25 btrfs_item_offset(item), 26 btrfs_item_offset(item),
26 btrfs_item_size(item)); 27 btrfs_item_size(item));
27 printf("\t\titem data %.*s\n", btrfs_item_size(item), 28 printf("\t\titem data %.*s\n", btrfs_item_size(item),
28 l->data + btrfs_item_offset(item)); 29 btrfs_leaf_data(l) + btrfs_item_offset(item));
29 ei = btrfs_item_ptr(l, i, struct btrfs_extent_item); 30 ei = btrfs_item_ptr(l, i, struct btrfs_extent_item);
30 printf("\t\textent data refs %u owner %Lu\n", 31 printf("\t\textent data refs %u owner %Lu\n",
31 btrfs_extent_refs(ei), btrfs_extent_owner(ei)); 32 btrfs_extent_refs(ei), btrfs_extent_owner(ei));
@@ -46,18 +47,18 @@ void btrfs_print_tree(struct btrfs_root *root, struct btrfs_buffer *t)
46 c = &t->node; 47 c = &t->node;
47 nr = btrfs_header_nritems(&c->header); 48 nr = btrfs_header_nritems(&c->header);
48 if (btrfs_is_leaf(c)) { 49 if (btrfs_is_leaf(c)) {
49 btrfs_print_leaf((struct btrfs_leaf *)c); 50 btrfs_print_leaf(root, (struct btrfs_leaf *)c);
50 return; 51 return;
51 } 52 }
52 printf("node %Lu level %d total ptrs %d free spc %u\n", t->blocknr, 53 printf("node %Lu level %d total ptrs %d free spc %u\n", t->blocknr,
53 btrfs_header_level(&c->header), nr, 54 btrfs_header_level(&c->header), nr,
54 (u32)NODEPTRS_PER_BLOCK - nr); 55 (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr);
55 fflush(stdout); 56 fflush(stdout);
56 for (i = 0; i < nr; i++) { 57 for (i = 0; i < nr; i++) {
57 printf("\tkey %d (%Lu %u %Lu) block %Lu\n", 58 printf("\tkey %d (%Lu %u %Lu) block %Lu\n",
58 i, 59 i,
59 c->keys[i].objectid, c->keys[i].flags, c->keys[i].offset, 60 c->ptrs[i].key.objectid, c->ptrs[i].key.flags,
60 btrfs_node_blockptr(c, i)); 61 c->ptrs[i].key.offset, btrfs_node_blockptr(c, i));
61 fflush(stdout); 62 fflush(stdout);
62 } 63 }
63 for (i = 0; i < nr; i++) { 64 for (i = 0; i < nr; i++) {