diff options
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r-- | fs/btrfs/extent_map.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index f5a04eb9a2ac..81123277c2b8 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -206,10 +206,11 @@ int add_extent_mapping(struct extent_map_tree *tree, | |||
206 | struct extent_map *merge = NULL; | 206 | struct extent_map *merge = NULL; |
207 | struct rb_node *rb; | 207 | struct rb_node *rb; |
208 | 208 | ||
209 | BUG_ON(spin_trylock(&tree->lock)); | ||
209 | rb = tree_insert(&tree->map, em->start, &em->rb_node); | 210 | rb = tree_insert(&tree->map, em->start, &em->rb_node); |
210 | if (rb) { | 211 | if (rb) { |
211 | merge = rb_entry(rb, struct extent_map, rb_node); | ||
212 | ret = -EEXIST; | 212 | ret = -EEXIST; |
213 | free_extent_map(merge); | ||
213 | goto out; | 214 | goto out; |
214 | } | 215 | } |
215 | atomic_inc(&em->refs); | 216 | atomic_inc(&em->refs); |
@@ -268,6 +269,7 @@ struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree, | |||
268 | struct rb_node *next = NULL; | 269 | struct rb_node *next = NULL; |
269 | u64 end = range_end(start, len); | 270 | u64 end = range_end(start, len); |
270 | 271 | ||
272 | BUG_ON(spin_trylock(&tree->lock)); | ||
271 | em = tree->last; | 273 | em = tree->last; |
272 | if (em && end > em->start && start < extent_map_end(em)) | 274 | if (em && end > em->start && start < extent_map_end(em)) |
273 | goto found; | 275 | goto found; |
@@ -318,6 +320,7 @@ int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em) | |||
318 | { | 320 | { |
319 | int ret = 0; | 321 | int ret = 0; |
320 | 322 | ||
323 | BUG_ON(spin_trylock(&tree->lock)); | ||
321 | rb_erase(&em->rb_node, &tree->map); | 324 | rb_erase(&em->rb_node, &tree->map); |
322 | em->in_tree = 0; | 325 | em->in_tree = 0; |
323 | if (tree->last == em) | 326 | if (tree->last == em) |