aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/extent-tree.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index f50c7c2e2b59..99a8e57da8a1 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7029,6 +7029,7 @@ static noinline int find_free_extent(struct btrfs_root *orig_root,
7029 bool failed_alloc = false; 7029 bool failed_alloc = false;
7030 bool use_cluster = true; 7030 bool use_cluster = true;
7031 bool have_caching_bg = false; 7031 bool have_caching_bg = false;
7032 bool orig_have_caching_bg = false;
7032 bool full_search = false; 7033 bool full_search = false;
7033 7034
7034 WARN_ON(num_bytes < root->sectorsize); 7035 WARN_ON(num_bytes < root->sectorsize);
@@ -7378,6 +7379,10 @@ loop:
7378 } 7379 }
7379 up_read(&space_info->groups_sem); 7380 up_read(&space_info->groups_sem);
7380 7381
7382 if ((loop == LOOP_CACHING_NOWAIT) && have_caching_bg
7383 && !orig_have_caching_bg)
7384 orig_have_caching_bg = true;
7385
7381 if (!ins->objectid && loop >= LOOP_CACHING_WAIT && have_caching_bg) 7386 if (!ins->objectid && loop >= LOOP_CACHING_WAIT && have_caching_bg)
7382 goto search; 7387 goto search;
7383 7388
@@ -7400,7 +7405,7 @@ loop:
7400 * don't have any unached bgs and we've alrelady done a 7405 * don't have any unached bgs and we've alrelady done a
7401 * full search through. 7406 * full search through.
7402 */ 7407 */
7403 if (have_caching_bg || !full_search) 7408 if (orig_have_caching_bg || !full_search)
7404 loop = LOOP_CACHING_WAIT; 7409 loop = LOOP_CACHING_WAIT;
7405 else 7410 else
7406 loop = LOOP_ALLOC_CHUNK; 7411 loop = LOOP_ALLOC_CHUNK;