aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/backref.c
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2012-05-22 07:43:25 -0400
committerJan Schmidt <list.btrfs@jan-o-sch.net>2012-05-26 06:17:51 -0400
commitdadcaf78b51e239d93f5ec9aac736de99081ee74 (patch)
treed4c9e78136621f901300c5e8e0846babc59daea3 /fs/btrfs/backref.c
parentcd1b413c5c863a96bfdeab8e91b1fb3a52665e42 (diff)
Btrfs: bugfix in btrfs_find_parent_nodes
That one has been around since the addition of backref.c. Due to the way we calculate our slot numbers, after adding inline refs we're missing one keyed ref unless it's located at the beginning of a new leaf. Reported-by: Alexander Block <ablock84@googlemail.com> Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs/backref.c')
-rw-r--r--fs/btrfs/backref.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index b41d94a6471b..c69a846999bf 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -413,7 +413,7 @@ static int __add_inline_refs(struct btrfs_fs_info *fs_info,
413 * enumerate all inline refs 413 * enumerate all inline refs
414 */ 414 */
415 leaf = path->nodes[0]; 415 leaf = path->nodes[0];
416 slot = path->slots[0] - 1; 416 slot = path->slots[0];
417 417
418 item_size = btrfs_item_size_nr(leaf, slot); 418 item_size = btrfs_item_size_nr(leaf, slot);
419 BUG_ON(item_size < sizeof(*ei)); 419 BUG_ON(item_size < sizeof(*ei));
@@ -661,8 +661,9 @@ again:
661 struct extent_buffer *leaf; 661 struct extent_buffer *leaf;
662 int slot; 662 int slot;
663 663
664 path->slots[0]--;
664 leaf = path->nodes[0]; 665 leaf = path->nodes[0];
665 slot = path->slots[0] - 1; 666 slot = path->slots[0];
666 btrfs_item_key_to_cpu(leaf, &key, slot); 667 btrfs_item_key_to_cpu(leaf, &key, slot);
667 if (key.objectid == bytenr && 668 if (key.objectid == bytenr &&
668 key.type == BTRFS_EXTENT_ITEM_KEY) { 669 key.type == BTRFS_EXTENT_ITEM_KEY) {