diff options
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r-- | fs/btrfs/extent_map.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 74b2a29880d..fd3ebfb8c3c 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -184,6 +184,13 @@ static int mergable_maps(struct extent_map *prev, struct extent_map *next) | |||
184 | if (test_bit(EXTENT_FLAG_PINNED, &prev->flags)) | 184 | if (test_bit(EXTENT_FLAG_PINNED, &prev->flags)) |
185 | return 0; | 185 | return 0; |
186 | 186 | ||
187 | /* | ||
188 | * don't merge compressed extents, we need to know their | ||
189 | * actual size | ||
190 | */ | ||
191 | if (test_bit(EXTENT_FLAG_COMPRESSED, &prev->flags)) | ||
192 | return 0; | ||
193 | |||
187 | if (extent_map_end(prev) == next->start && | 194 | if (extent_map_end(prev) == next->start && |
188 | prev->flags == next->flags && | 195 | prev->flags == next->flags && |
189 | prev->bdev == next->bdev && | 196 | prev->bdev == next->bdev && |
@@ -239,6 +246,7 @@ int add_extent_mapping(struct extent_map_tree *tree, | |||
239 | if (rb && mergable_maps(merge, em)) { | 246 | if (rb && mergable_maps(merge, em)) { |
240 | em->start = merge->start; | 247 | em->start = merge->start; |
241 | em->len += merge->len; | 248 | em->len += merge->len; |
249 | em->block_len += merge->block_len; | ||
242 | em->block_start = merge->block_start; | 250 | em->block_start = merge->block_start; |
243 | merge->in_tree = 0; | 251 | merge->in_tree = 0; |
244 | rb_erase(&merge->rb_node, &tree->map); | 252 | rb_erase(&merge->rb_node, &tree->map); |
@@ -250,6 +258,7 @@ int add_extent_mapping(struct extent_map_tree *tree, | |||
250 | merge = rb_entry(rb, struct extent_map, rb_node); | 258 | merge = rb_entry(rb, struct extent_map, rb_node); |
251 | if (rb && mergable_maps(em, merge)) { | 259 | if (rb && mergable_maps(em, merge)) { |
252 | em->len += merge->len; | 260 | em->len += merge->len; |
261 | em->block_len += merge->len; | ||
253 | rb_erase(&merge->rb_node, &tree->map); | 262 | rb_erase(&merge->rb_node, &tree->map); |
254 | merge->in_tree = 0; | 263 | merge->in_tree = 0; |
255 | free_extent_map(merge); | 264 | free_extent_map(merge); |