Commit ed8c4913 authored by Josef Bacik's avatar Josef Bacik Committed by Chris Mason

Btrfs: make sure the backref walker catches all refs to our extent

Because we don't mess with the offset into the extent for compressed we will
properly find both extents for this case

[extent a][extent b][rest of extent a]

but because we already added a ref for the front half we won't add the inode
information for the second half.  This causes us to leak that memory and not
print out the other offset when we do logical-resolve.  So fix this by calling
ulist_add_merge and then add our eie to the existing entry if there is one.
With this patch we get both offsets out of logical-resolve.  With this and the
other 2 patches I've sent we now pass btrfs/276 on my vm with compress-force=lzo
set.  Thanks,
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 8ca15e05
...@@ -196,7 +196,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, ...@@ -196,7 +196,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
struct extent_buffer *eb; struct extent_buffer *eb;
struct btrfs_key key; struct btrfs_key key;
struct btrfs_file_extent_item *fi; struct btrfs_file_extent_item *fi;
struct extent_inode_elem *eie = NULL; struct extent_inode_elem *eie = NULL, *old = NULL;
u64 disk_byte; u64 disk_byte;
if (level != 0) { if (level != 0) {
...@@ -230,6 +230,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, ...@@ -230,6 +230,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
if (disk_byte == wanted_disk_byte) { if (disk_byte == wanted_disk_byte) {
eie = NULL; eie = NULL;
old = NULL;
if (extent_item_pos) { if (extent_item_pos) {
ret = check_extent_in_eb(&key, eb, fi, ret = check_extent_in_eb(&key, eb, fi,
*extent_item_pos, *extent_item_pos,
...@@ -237,18 +238,20 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, ...@@ -237,18 +238,20 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
if (ret < 0) if (ret < 0)
break; break;
} }
if (!ret) { if (ret > 0)
ret = ulist_add(parents, eb->start, goto next;
(uintptr_t)eie, GFP_NOFS); ret = ulist_add_merge(parents, eb->start,
if (ret < 0) (uintptr_t)eie,
break; (u64 *)&old, GFP_NOFS);
if (!extent_item_pos) { if (ret < 0)
ret = btrfs_next_old_leaf(root, path, break;
time_seq); if (!ret && extent_item_pos) {
continue; while (old->next)
} old = old->next;
old->next = eie;
} }
} }
next:
ret = btrfs_next_old_item(root, path, time_seq); ret = btrfs_next_old_item(root, path, time_seq);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment