aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 4ef6dc3d7d32..e5340677d6c4 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -158,10 +158,10 @@ struct btrfs_block_group_cache *btrfs_lookup_block_group(struct
158 158
159 return NULL; 159 return NULL;
160} 160}
161
162static u64 find_search_start(struct btrfs_root *root, 161static u64 find_search_start(struct btrfs_root *root,
163 struct btrfs_block_group_cache **cache_ret, 162 struct btrfs_block_group_cache **cache_ret,
164 u64 search_start, int num, int data) 163 u64 search_start, int num,
164 int data, int full_scan)
165{ 165{
166 int ret; 166 int ret;
167 struct btrfs_block_group_cache *cache = *cache_ret; 167 struct btrfs_block_group_cache *cache = *cache_ret;
@@ -218,10 +218,10 @@ wrapped:
218 if (cache_miss && !cache->cached) { 218 if (cache_miss && !cache->cached) {
219 cache_block_group(root, cache); 219 cache_block_group(root, cache);
220 last = cache_miss; 220 last = cache_miss;
221
222 cache = btrfs_lookup_block_group(root->fs_info, last); 221 cache = btrfs_lookup_block_group(root->fs_info, last);
223 } 222 }
224 cache = btrfs_find_block_group(root, cache, last, data, 0); 223 if (!full_scan)
224 cache = btrfs_find_block_group(root, cache, last, data, 0);
225 *cache_ret = cache; 225 *cache_ret = cache;
226 cache_miss = 0; 226 cache_miss = 0;
227 goto again; 227 goto again;
@@ -979,12 +979,10 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
979 979
980 total_needed += empty_size; 980 total_needed += empty_size;
981 path = btrfs_alloc_path(); 981 path = btrfs_alloc_path();
982
983check_failed: 982check_failed:
984 search_start = find_search_start(root, &block_group, 983 search_start = find_search_start(root, &block_group, search_start,
985 search_start, total_needed, data); 984 total_needed, data, full_scan);
986 cached_start = search_start; 985 cached_start = search_start;
987
988 btrfs_init_path(path); 986 btrfs_init_path(path);
989 ins->objectid = search_start; 987 ins->objectid = search_start;
990 ins->offset = 0; 988 ins->offset = 0;