aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/print-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-15 12:56:47 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-15 12:56:47 -0400
commit62e2749e03a855d98855f9ce032dbe72d5fad148 (patch)
treeed12521d1bde4ac7eda7f917b57b3cab1e76539d /fs/btrfs/print-tree.c
parenta1516c8921ce2c148b69493e858d95bc79c92f01 (diff)
Btrfs: Use a chunk of the key flags to record the item type.
Add (untested and simple) directory item code Fix comp_keys to use the new key ordering Add btrfs_insert_empty_item Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/print-tree.c')
-rw-r--r--fs/btrfs/print-tree.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index 4c710190343d..f2745b247473 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -12,27 +12,41 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
12 struct btrfs_item *item; 12 struct btrfs_item *item;
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 u32 type;
15 printf("leaf %Lu total ptrs %d free space %d\n", 16 printf("leaf %Lu total ptrs %d free space %d\n",
16 btrfs_header_blocknr(&l->header), nr, 17 btrfs_header_blocknr(&l->header), nr,
17 btrfs_leaf_free_space(root, l)); 18 btrfs_leaf_free_space(root, l));
18 fflush(stdout); 19 fflush(stdout);
19 for (i = 0 ; i < nr ; i++) { 20 for (i = 0 ; i < nr ; i++) {
20 item = l->items + i; 21 item = l->items + i;
22 type = btrfs_disk_key_type(&item->key);
21 printf("\titem %d key (%Lu %Lu %u) itemoff %d itemsize %d\n", 23 printf("\titem %d key (%Lu %Lu %u) itemoff %d itemsize %d\n",
22 i, 24 i,
23 btrfs_key_objectid(&item->key), 25 btrfs_disk_key_objectid(&item->key),
24 btrfs_key_offset(&item->key), 26 btrfs_disk_key_offset(&item->key),
25 btrfs_key_flags(&item->key), 27 btrfs_disk_key_flags(&item->key),
26 btrfs_item_offset(item), 28 btrfs_item_offset(item),
27 btrfs_item_size(item)); 29 btrfs_item_size(item));
28 printf("\t\titem data %.*s\n", btrfs_item_size(item), 30 switch (type) {
29 btrfs_leaf_data(l) + btrfs_item_offset(item)); 31 case BTRFS_INODE_ITEM_KEY:
30 ei = btrfs_item_ptr(l, i, struct btrfs_extent_item); 32 break;
31 printf("\t\textent data refs %u owner %Lu\n", 33 case BTRFS_DIR_ITEM_KEY:
32 btrfs_extent_refs(ei), btrfs_extent_owner(ei)); 34 break;
33 ri = btrfs_item_ptr(l, i, struct btrfs_root_item); 35 case BTRFS_ROOT_ITEM_KEY:
34 printf("\t\troot data blocknr %Lu refs %u\n", 36 ri = btrfs_item_ptr(l, i, struct btrfs_root_item);
35 btrfs_root_blocknr(ri), btrfs_root_refs(ri)); 37 printf("\t\troot data blocknr %Lu refs %u\n",
38 btrfs_root_blocknr(ri), btrfs_root_refs(ri));
39 break;
40 case BTRFS_EXTENT_ITEM_KEY:
41 ei = btrfs_item_ptr(l, i, struct btrfs_extent_item);
42 printf("\t\textent data refs %u owner %Lu\n",
43 btrfs_extent_refs(ei), btrfs_extent_owner(ei));
44 break;
45 case BTRFS_STRING_ITEM_KEY:
46 printf("\t\titem data %.*s\n", btrfs_item_size(item),
47 btrfs_leaf_data(l) + btrfs_item_offset(item));
48 break;
49 };
36 fflush(stdout); 50 fflush(stdout);
37 } 51 }
38} 52}