diff options
-rw-r--r-- | fs/btrfs/extent-tree.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 1121d518bf8c..ee73efe75423 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2034,6 +2034,8 @@ int btrfs_update_pinned_extents(struct btrfs_root *root, | |||
2034 | spin_unlock(&cache->lock); | 2034 | spin_unlock(&cache->lock); |
2035 | spin_unlock(&cache->space_info->lock); | 2035 | spin_unlock(&cache->space_info->lock); |
2036 | fs_info->total_pinned -= len; | 2036 | fs_info->total_pinned -= len; |
2037 | if (cache->cached) | ||
2038 | btrfs_add_free_space(cache, bytenr, len); | ||
2037 | } | 2039 | } |
2038 | bytenr += len; | 2040 | bytenr += len; |
2039 | num -= len; | 2041 | num -= len; |
@@ -2099,7 +2101,6 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, | |||
2099 | u64 start; | 2101 | u64 start; |
2100 | u64 end; | 2102 | u64 end; |
2101 | int ret; | 2103 | int ret; |
2102 | struct btrfs_block_group_cache *cache; | ||
2103 | 2104 | ||
2104 | mutex_lock(&root->fs_info->pinned_mutex); | 2105 | mutex_lock(&root->fs_info->pinned_mutex); |
2105 | while(1) { | 2106 | while(1) { |
@@ -2109,9 +2110,6 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, | |||
2109 | break; | 2110 | break; |
2110 | btrfs_update_pinned_extents(root, start, end + 1 - start, 0); | 2111 | btrfs_update_pinned_extents(root, start, end + 1 - start, 0); |
2111 | clear_extent_dirty(unpin, start, end, GFP_NOFS); | 2112 | clear_extent_dirty(unpin, start, end, GFP_NOFS); |
2112 | cache = btrfs_lookup_block_group(root->fs_info, start); | ||
2113 | if (cache->cached) | ||
2114 | btrfs_add_free_space(cache, start, end - start + 1); | ||
2115 | if (need_resched()) { | 2113 | if (need_resched()) { |
2116 | mutex_unlock(&root->fs_info->pinned_mutex); | 2114 | mutex_unlock(&root->fs_info->pinned_mutex); |
2117 | cond_resched(); | 2115 | cond_resched(); |