summaryrefslogtreecommitdiff
path: root/extent-tree.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-08-26 09:51:36 -0400
committerChris Mason <chris.mason@oracle.com>2011-10-27 12:49:54 -0400
commitbe826706b5c0fcca3bdeff6934cd8d46d046ddfe (patch)
tree181c26d6f5d769dbbcbff217dc75f80eaa46bc51 /extent-tree.c
parentbed7475d77c4891abeb457a8f0b08353501a907c (diff)
btrfs-progs: add a recovery utility to pull files from damanged filesystems
Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'extent-tree.c')
-rw-r--r--extent-tree.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/extent-tree.c b/extent-tree.c
index b5b7aaa5..5bed3c27 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -1039,6 +1039,13 @@ static int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
err = ret;
goto out;
}
+ if (ret) {
+ printf("Failed to find [%llu, %u, %llu]\n", key.objectid, key.type, key.offset);
+ btrfs_print_leaf(root, path->nodes[0]);
+ btrfs_free_path(path);
+ return -ENOENT;
+ }
+
BUG_ON(ret);
leaf = path->nodes[0];
@@ -1059,6 +1066,12 @@ static int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
item_size = btrfs_item_size_nr(leaf, path->slots[0]);
}
#endif
+ if (item_size < sizeof(*ei)) {
+ printf("Size is %u, needs to be %u, slot %d\n", item_size,
+ sizeof(*ei), path->slots[0]);
+ btrfs_print_leaf(root, leaf);
+ return -EINVAL;
+ }
BUG_ON(item_size < sizeof(*ei));
ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item);