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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index d0fc4c5aaf15..110d3cb7b6fe 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -609,6 +609,7 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
609 int ret; 609 int ret;
610 int modify_tree = -1; 610 int modify_tree = -1;
611 int update_refs = (root->ref_cows || root == root->fs_info->tree_root); 611 int update_refs = (root->ref_cows || root == root->fs_info->tree_root);
612 int found = 0;
612 613
613 if (drop_cache) 614 if (drop_cache)
614 btrfs_drop_extent_cache(inode, start, end - 1, 0); 615 btrfs_drop_extent_cache(inode, start, end - 1, 0);
@@ -674,6 +675,7 @@ next_slot:
674 goto next_slot; 675 goto next_slot;
675 } 676 }
676 677
678 found = 1;
677 search_start = max(key.offset, start); 679 search_start = max(key.offset, start);
678 if (recow || !modify_tree) { 680 if (recow || !modify_tree) {
679 modify_tree = -1; 681 modify_tree = -1;
@@ -829,7 +831,7 @@ next_slot:
829 } 831 }
830 832
831 if (drop_end) 833 if (drop_end)
832 *drop_end = min(end, extent_end); 834 *drop_end = found ? min(end, extent_end) : end;
833 btrfs_release_path(path); 835 btrfs_release_path(path);
834 return ret; 836 return ret;
835} 837}