diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-12-12 14:39:36 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-12-12 14:39:36 -0500 |
commit | fba66bd8652b954be7e98699d81c8e57222b77e4 (patch) | |
tree | 18408392b6a0a95e60b6806e00c6ba94515102c2 /print-tree.c | |
parent | 66d0930cf68e6acf62bd505e0365e783bd14f981 (diff) | |
download | btrfs-progs-fba66bd8652b954be7e98699d81c8e57222b77e4.tar.gz |
Add back pointers from the inode to the directory that referenced it
Diffstat (limited to 'print-tree.c')
-rw-r--r-- | print-tree.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/print-tree.c b/print-tree.c index 9c85f63..60cf27c 100644 --- a/print-tree.c +++ b/print-tree.c @@ -45,6 +45,24 @@ static int print_dir_item(struct btrfs_item *item, } return 0; } + +static int print_inode_ref_item(struct btrfs_item *item, + struct btrfs_inode_ref *ref) +{ + u32 total; + u32 cur = 0; + u32 len; + total = btrfs_item_size(item); + while(cur < total) { + len = btrfs_inode_ref_name_len(ref); + printf("\t\tinode ref name: %.*s\n", len, (char *)(ref + 1)); + len += sizeof(*ref); + ref = (struct btrfs_inode_ref *)((char *)ref + len); + cur += len; + } + return 0; +} + void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) { int i; @@ -58,6 +76,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) struct btrfs_csum_item *ci; struct btrfs_block_group_item *bi; struct btrfs_extent_ref *ref; + struct btrfs_inode_ref *iref; u32 type; printf("leaf %llu ptrs %d free space %d generation %llu owner %llu\n", @@ -86,6 +105,10 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) btrfs_inode_mode(ii), btrfs_inode_nlink(ii)); break; + case BTRFS_INODE_REF_KEY: + iref = btrfs_item_ptr(l, i, struct btrfs_inode_ref); + print_inode_ref_item(l->items + i, iref); + break; case BTRFS_DIR_ITEM_KEY: di = btrfs_item_ptr(l, i, struct btrfs_dir_item); print_dir_item(l->items + i, di); |