diff options
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 55d6a66c622d..b7530c3ac206 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2174,6 +2174,9 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans, | |||
2174 | * group thats not of the proper type, while looping this | 2174 | * group thats not of the proper type, while looping this |
2175 | * should never happen | 2175 | * should never happen |
2176 | */ | 2176 | */ |
2177 | if (empty_size) | ||
2178 | extra_loop = 1; | ||
2179 | |||
2177 | if (!block_group) | 2180 | if (!block_group) |
2178 | goto new_group_no_lock; | 2181 | goto new_group_no_lock; |
2179 | 2182 | ||
@@ -2192,9 +2195,6 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans, | |||
2192 | 2195 | ||
2193 | free_space = btrfs_find_free_space(block_group, search_start, | 2196 | free_space = btrfs_find_free_space(block_group, search_start, |
2194 | total_needed); | 2197 | total_needed); |
2195 | if (empty_size) | ||
2196 | extra_loop = 1; | ||
2197 | |||
2198 | if (free_space) { | 2198 | if (free_space) { |
2199 | u64 start = block_group->key.objectid; | 2199 | u64 start = block_group->key.objectid; |
2200 | u64 end = block_group->key.objectid + | 2200 | u64 end = block_group->key.objectid + |
@@ -2212,6 +2212,7 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans, | |||
2212 | 2212 | ||
2213 | if (last_wanted && search_start != last_wanted) { | 2213 | if (last_wanted && search_start != last_wanted) { |
2214 | total_needed += empty_cluster; | 2214 | total_needed += empty_cluster; |
2215 | empty_size += empty_cluster; | ||
2215 | last_wanted = 0; | 2216 | last_wanted = 0; |
2216 | /* | 2217 | /* |
2217 | * if search_start is still in this block group | 2218 | * if search_start is still in this block group |