diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-03-21 11:12:56 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-03-21 11:12:56 -0400 |
commit | 2e635a278354a1a7951e16cfea4c247d6d0e7c99 (patch) | |
tree | 4b94d54ddcd7cb184681260738b68caef4edee81 /fs/btrfs/print-tree.c | |
parent | 1261ec42b3d3a3ad878bd172144940e3ac710749 (diff) |
Btrfs: initial move to kernel module land
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/print-tree.c')
-rw-r--r-- | fs/btrfs/print-tree.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index f53b99da12f..aa2d3fac880 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
@@ -1,7 +1,4 @@ | |||
1 | #include <stdio.h> | 1 | #include <linux/module.h> |
2 | #include <stdlib.h> | ||
3 | #include "kerncompat.h" | ||
4 | #include "radix-tree.h" | ||
5 | #include "ctree.h" | 2 | #include "ctree.h" |
6 | #include "disk-io.h" | 3 | #include "disk-io.h" |
7 | 4 | ||
@@ -17,14 +14,14 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) | |||
17 | struct btrfs_inode_item *ii; | 14 | struct btrfs_inode_item *ii; |
18 | u32 type; | 15 | u32 type; |
19 | 16 | ||
20 | printf("leaf %Lu total ptrs %d free space %d\n", | 17 | printk("leaf %Lu total ptrs %d free space %d\n", |
21 | btrfs_header_blocknr(&l->header), nr, | 18 | btrfs_header_blocknr(&l->header), nr, |
22 | btrfs_leaf_free_space(root, l)); | 19 | btrfs_leaf_free_space(root, l)); |
23 | fflush(stdout); | 20 | fflush(stdout); |
24 | for (i = 0 ; i < nr ; i++) { | 21 | for (i = 0 ; i < nr ; i++) { |
25 | item = l->items + i; | 22 | item = l->items + i; |
26 | type = btrfs_disk_key_type(&item->key); | 23 | type = btrfs_disk_key_type(&item->key); |
27 | printf("\titem %d key (%Lu %u %Lu) itemoff %d itemsize %d\n", | 24 | printk("\titem %d key (%Lu %u %Lu) itemoff %d itemsize %d\n", |
28 | i, | 25 | i, |
29 | btrfs_disk_key_objectid(&item->key), | 26 | btrfs_disk_key_objectid(&item->key), |
30 | btrfs_disk_key_flags(&item->key), | 27 | btrfs_disk_key_flags(&item->key), |
@@ -34,38 +31,39 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) | |||
34 | switch (type) { | 31 | switch (type) { |
35 | case BTRFS_INODE_ITEM_KEY: | 32 | case BTRFS_INODE_ITEM_KEY: |
36 | ii = btrfs_item_ptr(l, i, struct btrfs_inode_item); | 33 | ii = btrfs_item_ptr(l, i, struct btrfs_inode_item); |
37 | printf("\t\tinode generation %Lu size %Lu\n", | 34 | printk("\t\tinode generation %Lu size %Lu mode %o\n", |
38 | btrfs_inode_generation(ii), | 35 | btrfs_inode_generation(ii), |
39 | btrfs_inode_size(ii)); | 36 | btrfs_inode_size(ii), |
37 | btrfs_inode_mode(ii)); | ||
40 | break; | 38 | break; |
41 | case BTRFS_DIR_ITEM_KEY: | 39 | case BTRFS_DIR_ITEM_KEY: |
42 | di = btrfs_item_ptr(l, i, struct btrfs_dir_item); | 40 | di = btrfs_item_ptr(l, i, struct btrfs_dir_item); |
43 | printf("\t\tdir oid %Lu flags %u type %u\n", | 41 | printk("\t\tdir oid %Lu flags %u type %u\n", |
44 | btrfs_dir_objectid(di), | 42 | btrfs_dir_objectid(di), |
45 | btrfs_dir_flags(di), | 43 | btrfs_dir_flags(di), |
46 | btrfs_dir_type(di)); | 44 | btrfs_dir_type(di)); |
47 | printf("\t\tname %.*s\n", | 45 | printk("\t\tname %.*s\n", |
48 | btrfs_dir_name_len(di),(char *)(di + 1)); | 46 | btrfs_dir_name_len(di),(char *)(di + 1)); |
49 | break; | 47 | break; |
50 | case BTRFS_ROOT_ITEM_KEY: | 48 | case BTRFS_ROOT_ITEM_KEY: |
51 | ri = btrfs_item_ptr(l, i, struct btrfs_root_item); | 49 | ri = btrfs_item_ptr(l, i, struct btrfs_root_item); |
52 | printf("\t\troot data blocknr %Lu refs %u\n", | 50 | printk("\t\troot data blocknr %Lu refs %u\n", |
53 | btrfs_root_blocknr(ri), btrfs_root_refs(ri)); | 51 | btrfs_root_blocknr(ri), btrfs_root_refs(ri)); |
54 | break; | 52 | break; |
55 | case BTRFS_EXTENT_ITEM_KEY: | 53 | case BTRFS_EXTENT_ITEM_KEY: |
56 | ei = btrfs_item_ptr(l, i, struct btrfs_extent_item); | 54 | ei = btrfs_item_ptr(l, i, struct btrfs_extent_item); |
57 | printf("\t\textent data refs %u owner %Lu\n", | 55 | printk("\t\textent data refs %u owner %Lu\n", |
58 | btrfs_extent_refs(ei), btrfs_extent_owner(ei)); | 56 | btrfs_extent_refs(ei), btrfs_extent_owner(ei)); |
59 | break; | 57 | break; |
60 | case BTRFS_INODE_MAP_ITEM_KEY: | 58 | case BTRFS_INODE_MAP_ITEM_KEY: |
61 | mi = btrfs_item_ptr(l, i, struct btrfs_inode_map_item); | 59 | mi = btrfs_item_ptr(l, i, struct btrfs_inode_map_item); |
62 | printf("\t\tinode map key %Lu %u %Lu\n", | 60 | printk("\t\tinode map key %Lu %u %Lu\n", |
63 | btrfs_disk_key_objectid(&mi->key), | 61 | btrfs_disk_key_objectid(&mi->key), |
64 | btrfs_disk_key_flags(&mi->key), | 62 | btrfs_disk_key_flags(&mi->key), |
65 | btrfs_disk_key_offset(&mi->key)); | 63 | btrfs_disk_key_offset(&mi->key)); |
66 | break; | 64 | break; |
67 | case BTRFS_STRING_ITEM_KEY: | 65 | case BTRFS_STRING_ITEM_KEY: |
68 | printf("\t\titem data %.*s\n", btrfs_item_size(item), | 66 | printk("\t\titem data %.*s\n", btrfs_item_size(item), |
69 | btrfs_leaf_data(l) + btrfs_item_offset(item)); | 67 | btrfs_leaf_data(l) + btrfs_item_offset(item)); |
70 | break; | 68 | break; |
71 | }; | 69 | }; |
@@ -86,12 +84,12 @@ void btrfs_print_tree(struct btrfs_root *root, struct btrfs_buffer *t) | |||
86 | btrfs_print_leaf(root, (struct btrfs_leaf *)c); | 84 | btrfs_print_leaf(root, (struct btrfs_leaf *)c); |
87 | return; | 85 | return; |
88 | } | 86 | } |
89 | printf("node %Lu level %d total ptrs %d free spc %u\n", t->blocknr, | 87 | printk("node %Lu level %d total ptrs %d free spc %u\n", t->blocknr, |
90 | btrfs_header_level(&c->header), nr, | 88 | btrfs_header_level(&c->header), nr, |
91 | (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr); | 89 | (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr); |
92 | fflush(stdout); | 90 | fflush(stdout); |
93 | for (i = 0; i < nr; i++) { | 91 | for (i = 0; i < nr; i++) { |
94 | printf("\tkey %d (%Lu %u %Lu) block %Lu\n", | 92 | printk("\tkey %d (%Lu %u %Lu) block %Lu\n", |
95 | i, | 93 | i, |
96 | c->ptrs[i].key.objectid, | 94 | c->ptrs[i].key.objectid, |
97 | c->ptrs[i].key.flags, | 95 | c->ptrs[i].key.flags, |