Btrfs: fix extent_map block_len after merging
authorFilipe David Borba Manana <fdmanana@gmail.com>
Sat, 30 Nov 2013 11:28:35 +0000 (11:28 +0000)
committerChris Mason <clm@fb.com>
Tue, 28 Jan 2014 21:19:51 +0000 (13:19 -0800)
When merging an extent_map with its right neighbor, increment
its block_len with the neighbor's block_len.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/extent_map.c

index b60955d4f9bfed5b5c086f85d4a23dfabd52a6fc..996ad56b57db64bbc0516f4674d8ad3fd2d43976 100644 (file)
@@ -255,7 +255,7 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em)
                merge = rb_entry(rb, struct extent_map, rb_node);
        if (rb && mergable_maps(em, merge)) {
                em->len += merge->len;
-               em->block_len += merge->len;
+               em->block_len += merge->block_len;
                rb_erase(&merge->rb_node, &tree->map);
                merge->in_tree = 0;
                em->mod_len = (merge->mod_start + merge->mod_len) - em->mod_start;