aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 40ad1b2958cb..eccdb9562ba8 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -358,9 +358,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end)
358 struct extent_map *split = NULL; 358 struct extent_map *split = NULL;
359 struct extent_map *split2 = NULL; 359 struct extent_map *split2 = NULL;
360 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; 360 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
361 struct extent_map *tmp;
362 u64 len = end - start + 1; 361 u64 len = end - start + 1;
363 u64 next_start;
364 int ret; 362 int ret;
365 int testend = 1; 363 int testend = 1;
366 364
@@ -381,8 +379,16 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end)
381 spin_unlock(&em_tree->lock); 379 spin_unlock(&em_tree->lock);
382 break; 380 break;
383 } 381 }
384 tmp = rb_entry(&em->rb_node, struct extent_map, rb_node); 382 if (test_bit(EXTENT_FLAG_PINNED, &em->flags)) {
385 next_start = tmp->start; 383 start = em->start + em->len;
384 free_extent_map(em);
385 spin_unlock(&em_tree->lock);
386 if (start < end) {
387 len = end - start + 1;
388 continue;
389 }
390 break;
391 }
386 remove_extent_mapping(em_tree, em); 392 remove_extent_mapping(em_tree, em);
387 393
388 if (em->block_start < EXTENT_MAP_LAST_BYTE && 394 if (em->block_start < EXTENT_MAP_LAST_BYTE &&