diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-03-15 15:18:43 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-03-15 15:18:43 -0400 |
commit | 1d4f6404de26df49eb8452f8fdf7672b59f407fc (patch) | |
tree | 9bbc9fdd45f8e9fc5444e8c84f4777a607c13e2b /fs/btrfs/print-tree.c | |
parent | 24af03ea5e765d57860c975efcdcd41ec7f63fd9 (diff) |
Btrfs: directory testing code and dir item fixes
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 | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index f2745b247473..ad244d658117 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
@@ -12,7 +12,10 @@ 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 | struct btrfs_dir_item *di; | ||
15 | u32 type; | 16 | u32 type; |
17 | u32 namelen; | ||
18 | |||
16 | printf("leaf %Lu total ptrs %d free space %d\n", | 19 | printf("leaf %Lu total ptrs %d free space %d\n", |
17 | btrfs_header_blocknr(&l->header), nr, | 20 | btrfs_header_blocknr(&l->header), nr, |
18 | btrfs_leaf_free_space(root, l)); | 21 | btrfs_leaf_free_space(root, l)); |
@@ -31,6 +34,15 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) | |||
31 | case BTRFS_INODE_ITEM_KEY: | 34 | case BTRFS_INODE_ITEM_KEY: |
32 | break; | 35 | break; |
33 | case BTRFS_DIR_ITEM_KEY: | 36 | case BTRFS_DIR_ITEM_KEY: |
37 | namelen = btrfs_item_size(l->items + i) - sizeof(*di); | ||
38 | di = btrfs_item_ptr(l, i, struct btrfs_dir_item); | ||
39 | printf("\t\tdir oid %Lu flags %u type %u\n", | ||
40 | btrfs_dir_objectid(di), | ||
41 | btrfs_dir_flags(di), | ||
42 | btrfs_dir_type(di)); | ||
43 | printf("\t\tname %.*s\n", | ||
44 | namelen, (char *)(di + 1)); | ||
45 | |||
34 | break; | 46 | break; |
35 | case BTRFS_ROOT_ITEM_KEY: | 47 | case BTRFS_ROOT_ITEM_KEY: |
36 | ri = btrfs_item_ptr(l, i, struct btrfs_root_item); | 48 | ri = btrfs_item_ptr(l, i, struct btrfs_root_item); |