Skip to content

Commit 1b22bad

Browse files
Alexandre Olivachrismason-xx
authored andcommitted
Btrfs: start search for new cluster at the beginning
Instead of starting at zero (offset is always zero), request a cluster starting at search_start, that denotes the beginning of the current block group. Signed-off-by: Alexandre Oliva <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent b78d09b commit 1b22bad

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/btrfs/extent-tree.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5301,10 +5301,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
53015301
spin_lock(&last_ptr->refill_lock);
53025302
if (last_ptr->block_group &&
53035303
(last_ptr->block_group->ro ||
5304-
!block_group_bits(last_ptr->block_group, data))) {
5305-
offset = 0;
5304+
!block_group_bits(last_ptr->block_group, data)))
53065305
goto refill_cluster;
5307-
}
53085306

53095307
offset = btrfs_alloc_from_cluster(block_group, last_ptr,
53105308
num_bytes, search_start);
@@ -5355,7 +5353,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
53555353
/* allocate a cluster in this block group */
53565354
ret = btrfs_find_space_cluster(trans, root,
53575355
block_group, last_ptr,
5358-
offset, num_bytes,
5356+
search_start, num_bytes,
53595357
empty_cluster + empty_size);
53605358
if (ret == 0) {
53615359
/*

0 commit comments

Comments
 (0)