aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 8043b9d584a9..64e14ddf6232 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2238,7 +2238,10 @@ static int noinline find_free_extent(struct btrfs_trans_handle *trans,
2238 total_needed += empty_size; 2238 total_needed += empty_size;
2239 2239
2240new_group: 2240new_group:
2241 block_group = btrfs_lookup_first_block_group(info, search_start); 2241 block_group = btrfs_lookup_block_group(info, search_start);
2242 if (!block_group)
2243 block_group = btrfs_lookup_first_block_group(info,
2244 search_start);
2242 2245
2243 /* 2246 /*
2244 * Ok this looks a little tricky, buts its really simple. First if we 2247 * Ok this looks a little tricky, buts its really simple. First if we
@@ -2255,8 +2258,10 @@ new_group:
2255 if (!block_group || (!block_group_bits(block_group, data) && 2258 if (!block_group || (!block_group_bits(block_group, data) &&
2256 last_ptr && *last_ptr)) { 2259 last_ptr && *last_ptr)) {
2257 if (search_start != orig_search_start) { 2260 if (search_start != orig_search_start) {
2258 if (last_ptr && *last_ptr) 2261 if (last_ptr && *last_ptr) {
2262 total_needed += empty_cluster;
2259 *last_ptr = 0; 2263 *last_ptr = 0;
2264 }
2260 search_start = orig_search_start; 2265 search_start = orig_search_start;
2261 goto new_group; 2266 goto new_group;
2262 } else if (!chunk_alloc_done && allowed_chunk_alloc) { 2267 } else if (!chunk_alloc_done && allowed_chunk_alloc) {