diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-10-15 16:15:53 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:56 -0400 |
commit | db94535db75e67fab12ccbb7f5ee548e33fed891 (patch) | |
tree | 1ad7dfc82b003294a94ee87d7329b24b902b369f /fs/btrfs/print-tree.c | |
parent | 1a5bc167f6707542b79a55452075525620ed43f5 (diff) |
Btrfs: Allow tree blocks larger than the page size
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 | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index a825ce078a54..9f8696c8a8e8 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
@@ -36,7 +36,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l) | |||
36 | u32 type; | 36 | u32 type; |
37 | 37 | ||
38 | printk("leaf %llu total ptrs %d free space %d\n", | 38 | printk("leaf %llu total ptrs %d free space %d\n", |
39 | (unsigned long long)btrfs_header_blocknr(l), nr, | 39 | (unsigned long long)btrfs_header_bytenr(l), nr, |
40 | btrfs_leaf_free_space(root, l)); | 40 | btrfs_leaf_free_space(root, l)); |
41 | for (i = 0 ; i < nr ; i++) { | 41 | for (i = 0 ; i < nr ; i++) { |
42 | item = btrfs_item_nr(l, i); | 42 | item = btrfs_item_nr(l, i); |
@@ -65,8 +65,8 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l) | |||
65 | break; | 65 | break; |
66 | case BTRFS_ROOT_ITEM_KEY: | 66 | case BTRFS_ROOT_ITEM_KEY: |
67 | ri = btrfs_item_ptr(l, i, struct btrfs_root_item); | 67 | ri = btrfs_item_ptr(l, i, struct btrfs_root_item); |
68 | printk("\t\troot data blocknr %llu refs %u\n", | 68 | printk("\t\troot data bytenr %llu refs %u\n", |
69 | (unsigned long long)btrfs_disk_root_blocknr(l, ri), | 69 | (unsigned long long)btrfs_disk_root_bytenr(l, ri), |
70 | btrfs_disk_root_refs(l, ri)); | 70 | btrfs_disk_root_refs(l, ri)); |
71 | break; | 71 | break; |
72 | case BTRFS_EXTENT_ITEM_KEY: | 72 | case BTRFS_EXTENT_ITEM_KEY: |
@@ -84,12 +84,12 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l) | |||
84 | btrfs_file_extent_inline_len(l, item)); | 84 | btrfs_file_extent_inline_len(l, item)); |
85 | break; | 85 | break; |
86 | } | 86 | } |
87 | printk("\t\textent data disk block %llu nr %llu\n", | 87 | printk("\t\textent data disk bytenr %llu nr %llu\n", |
88 | (unsigned long long)btrfs_file_extent_disk_blocknr(l, fi), | 88 | (unsigned long long)btrfs_file_extent_disk_bytenr(l, fi), |
89 | (unsigned long long)btrfs_file_extent_disk_num_blocks(l, fi)); | 89 | (unsigned long long)btrfs_file_extent_disk_num_bytes(l, fi)); |
90 | printk("\t\textent data offset %llu nr %llu\n", | 90 | printk("\t\textent data offset %llu nr %llu\n", |
91 | (unsigned long long)btrfs_file_extent_offset(l, fi), | 91 | (unsigned long long)btrfs_file_extent_offset(l, fi), |
92 | (unsigned long long)btrfs_file_extent_num_blocks(l, fi)); | 92 | (unsigned long long)btrfs_file_extent_num_bytes(l, fi)); |
93 | break; | 93 | break; |
94 | case BTRFS_BLOCK_GROUP_ITEM_KEY: | 94 | case BTRFS_BLOCK_GROUP_ITEM_KEY: |
95 | bi = btrfs_item_ptr(l, i, | 95 | bi = btrfs_item_ptr(l, i, |
@@ -106,16 +106,18 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c) | |||
106 | int i; | 106 | int i; |
107 | u32 nr; | 107 | u32 nr; |
108 | struct btrfs_key key; | 108 | struct btrfs_key key; |
109 | int level; | ||
109 | 110 | ||
110 | if (!c) | 111 | if (!c) |
111 | return; | 112 | return; |
112 | nr = btrfs_header_nritems(c); | 113 | nr = btrfs_header_nritems(c); |
113 | if (btrfs_is_leaf(c)) { | 114 | level = btrfs_header_level(c); |
115 | if (level == 0) { | ||
114 | btrfs_print_leaf(root, c); | 116 | btrfs_print_leaf(root, c); |
115 | return; | 117 | return; |
116 | } | 118 | } |
117 | printk("node %llu level %d total ptrs %d free spc %u\n", | 119 | printk("node %llu level %d total ptrs %d free spc %u\n", |
118 | (unsigned long long)btrfs_header_blocknr(c), | 120 | (unsigned long long)btrfs_header_bytenr(c), |
119 | btrfs_header_level(c), nr, | 121 | btrfs_header_level(c), nr, |
120 | (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr); | 122 | (u32)BTRFS_NODEPTRS_PER_BLOCK(root) - nr); |
121 | for (i = 0; i < nr; i++) { | 123 | for (i = 0; i < nr; i++) { |
@@ -129,7 +131,8 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c) | |||
129 | } | 131 | } |
130 | for (i = 0; i < nr; i++) { | 132 | for (i = 0; i < nr; i++) { |
131 | struct extent_buffer *next = read_tree_block(root, | 133 | struct extent_buffer *next = read_tree_block(root, |
132 | btrfs_node_blockptr(c, i)); | 134 | btrfs_node_blockptr(c, i), |
135 | btrfs_level_size(root, level - 1)); | ||
133 | if (btrfs_is_leaf(next) && | 136 | if (btrfs_is_leaf(next) && |
134 | btrfs_header_level(c) != 1) | 137 | btrfs_header_level(c) != 1) |
135 | BUG(); | 138 | BUG(); |