From 05aa1dfff70ec7de9a3e0dbd3a2ee3af117bbdc3 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 14 Sep 2012 14:51:22 -0400 Subject: [PATCH] --- yaml --- r: 332580 b: refs/heads/master c: c3308f84c1743eabb91f4976a314d118d5ea2342 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/btrfs/file.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 2921b987642a..872d90a9df88 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 926ced123bd6651b30a07f65a2a8a0b26154cd58 +refs/heads/master: c3308f84c1743eabb91f4976a314d118d5ea2342 diff --git a/trunk/fs/btrfs/file.c b/trunk/fs/btrfs/file.c index d0fc4c5aaf15..110d3cb7b6fe 100644 --- a/trunk/fs/btrfs/file.c +++ b/trunk/fs/btrfs/file.c @@ -609,6 +609,7 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans, int ret; int modify_tree = -1; int update_refs = (root->ref_cows || root == root->fs_info->tree_root); + int found = 0; if (drop_cache) btrfs_drop_extent_cache(inode, start, end - 1, 0); @@ -674,6 +675,7 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans, goto next_slot; } + found = 1; search_start = max(key.offset, start); if (recow || !modify_tree) { modify_tree = -1; @@ -829,7 +831,7 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans, } if (drop_end) - *drop_end = min(end, extent_end); + *drop_end = found ? min(end, extent_end) : end; btrfs_release_path(path); return ret; }