aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/print-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/print-tree.c')
-rw-r--r--fs/btrfs/print-tree.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index da0b4dcf3617..9c1335dad40c 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -20,6 +20,40 @@
20#include "disk-io.h" 20#include "disk-io.h"
21#include "print-tree.h" 21#include "print-tree.h"
22 22
23static void print_chunk(struct extent_buffer *eb, struct btrfs_chunk *chunk)
24{
25 int num_stripes = btrfs_chunk_num_stripes(eb, chunk);
26 int i;
27 printk("\t\tchunk owner %llu type %llu num_stripes %d\n",
28 (unsigned long long)btrfs_chunk_owner(eb, chunk),
29 (unsigned long long)btrfs_chunk_type(eb, chunk),
30 num_stripes);
31 for (i = 0 ; i < num_stripes ; i++) {
32 printk("\t\t\tstripe %d devid %llu offset %llu\n", i,
33 (unsigned long long)btrfs_stripe_devid_nr(eb, chunk, i),
34 (unsigned long long)btrfs_stripe_offset_nr(eb, chunk, i));
35 }
36}
37static void print_dev_item(struct extent_buffer *eb,
38 struct btrfs_dev_item *dev_item)
39{
40 char *name;
41 int name_len;
42
43 name_len = btrfs_device_name_len(eb, dev_item);
44 name = kmalloc(name_len, GFP_NOFS);
45 if (name) {
46 read_extent_buffer(eb, name,
47 (unsigned long)btrfs_device_name(dev_item),
48 name_len);
49 }
50 printk("\t\tdev item name %.*s devid %llu "
51 "total_bytes %llu bytes used %Lu\n", name_len, name,
52 (unsigned long long)btrfs_device_id(eb, dev_item),
53 (unsigned long long)btrfs_device_total_bytes(eb, dev_item),
54 (unsigned long long)btrfs_device_bytes_used(eb, dev_item));
55 kfree(name);
56}
23void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l) 57void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
24{ 58{
25 int i; 59 int i;
@@ -34,6 +68,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
34 struct btrfs_key key; 68 struct btrfs_key key;
35 struct btrfs_key found_key; 69 struct btrfs_key found_key;
36 struct btrfs_extent_ref *ref; 70 struct btrfs_extent_ref *ref;
71 struct btrfs_dev_extent *dev_extent;
37 u32 type; 72 u32 type;
38 73
39 printk("leaf %llu total ptrs %d free space %d\n", 74 printk("leaf %llu total ptrs %d free space %d\n",
@@ -106,6 +141,19 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
106 printk("\t\tblock group used %llu\n", 141 printk("\t\tblock group used %llu\n",
107 (unsigned long long)btrfs_disk_block_group_used(l, bi)); 142 (unsigned long long)btrfs_disk_block_group_used(l, bi));
108 break; 143 break;
144 case BTRFS_CHUNK_ITEM_KEY:
145 print_chunk(l, btrfs_item_ptr(l, i, struct btrfs_chunk));
146 break;
147 case BTRFS_DEV_ITEM_KEY:
148 print_dev_item(l, btrfs_item_ptr(l, i,
149 struct btrfs_dev_item));
150 break;
151 case BTRFS_DEV_EXTENT_KEY:
152 dev_extent = btrfs_item_ptr(l, i,
153 struct btrfs_dev_extent);
154 printk("\t\tdev extent owner %llu length %llu\n",
155 (unsigned long long)btrfs_dev_extent_owner(l, dev_extent),
156 (unsigned long long)btrfs_dev_extent_length(l, dev_extent));
109 }; 157 };
110 } 158 }
111} 159}