提交 1b22bad7 编写于 作者: A Alexandre Oliva 提交者: Chris Mason

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: NAlexandre Oliva <oliva@lsd.ic.unicamp.br>
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 b78d09bc
...@@ -5301,10 +5301,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, ...@@ -5301,10 +5301,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
spin_lock(&last_ptr->refill_lock); spin_lock(&last_ptr->refill_lock);
if (last_ptr->block_group && if (last_ptr->block_group &&
(last_ptr->block_group->ro || (last_ptr->block_group->ro ||
!block_group_bits(last_ptr->block_group, data))) { !block_group_bits(last_ptr->block_group, data)))
offset = 0;
goto refill_cluster; goto refill_cluster;
}
offset = btrfs_alloc_from_cluster(block_group, last_ptr, offset = btrfs_alloc_from_cluster(block_group, last_ptr,
num_bytes, search_start); num_bytes, search_start);
...@@ -5355,7 +5353,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, ...@@ -5355,7 +5353,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
/* allocate a cluster in this block group */ /* allocate a cluster in this block group */
ret = btrfs_find_space_cluster(trans, root, ret = btrfs_find_space_cluster(trans, root,
block_group, last_ptr, block_group, last_ptr,
offset, num_bytes, search_start, num_bytes,
empty_cluster + empty_size); empty_cluster + empty_size);
if (ret == 0) { if (ret == 0) {
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册