aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/print-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-12 12:01:18 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-12 12:01:18 -0400
commit7518a238ea0152dc849d1ed76d3cae8b44e12f46 (patch)
tree97e5c285f10bdb2576046e7bb15d239471815c28 /fs/btrfs/print-tree.c
parent83e15a28e046dbb4534dd263d1d3dc867a8994a2 (diff)
Btrfs: get/set for struct header fields
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/print-tree.c')
-rw-r--r--fs/btrfs/print-tree.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index e32a959dd3e..7df16b1e473 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -8,11 +8,11 @@
void print_leaf(struct leaf *l)
{
int i;
- int nr = l->header.nritems;
+ u32 nr = btrfs_header_nritems(&l->header);
struct item *item;
struct extent_item *ei;
- printf("leaf %Lu total ptrs %d free space %d\n", l->header.blocknr, nr,
- leaf_free_space(l));
+ printf("leaf %Lu total ptrs %d free space %d\n",
+ btrfs_header_blocknr(&l->header), nr, leaf_free_space(l));
fflush(stdout);
for (i = 0 ; i < nr ; i++) {
item = l->items + i;
@@ -32,22 +32,20 @@ void print_leaf(struct leaf *l)
void print_tree(struct ctree_root *root, struct tree_buffer *t)
{
int i;
- int nr;
+ u32 nr;
struct node *c;
if (!t)
return;
c = &t->node;
- nr = c->header.nritems;
- if (c->header.blocknr != t->blocknr)
- BUG();
- if (is_leaf(c->header.flags)) {
+ nr = btrfs_header_nritems(&c->header);
+ if (btrfs_is_leaf(c)) {
print_leaf((struct leaf *)c);
return;
}
printf("node %Lu level %d total ptrs %d free spc %u\n", t->blocknr,
- node_level(c->header.flags), c->header.nritems,
- (u32)NODEPTRS_PER_BLOCK - c->header.nritems);
+ btrfs_header_level(&c->header), nr,
+ (u32)NODEPTRS_PER_BLOCK - nr);
fflush(stdout);
for (i = 0; i < nr; i++) {
printf("\tkey %d (%Lu %u %Lu) block %Lu\n",
@@ -60,11 +58,11 @@ void print_tree(struct ctree_root *root, struct tree_buffer *t)
struct tree_buffer *next_buf = read_tree_block(root,
c->blockptrs[i]);
struct node *next = &next_buf->node;
- if (is_leaf(next->header.flags) &&
- node_level(c->header.flags) != 1)
+ if (btrfs_is_leaf(next) &&
+ btrfs_header_level(&c->header) != 1)
BUG();
- if (node_level(next->header.flags) !=
- node_level(c->header.flags) - 1)
+ if (btrfs_header_level(&next->header) !=
+ btrfs_header_level(&c->header) - 1)
BUG();
print_tree(root, next_buf);
tree_block_release(root, next_buf);