Skip to content

Commit 425d831

Browse files
Alexandre Olivachrismason-xx
authored andcommitted
Btrfs: skip block groups without enough space for a cluster
We test whether a block group has enough free space to hold the requested block, but when we're doing clustered allocation, we can save some cycles by testing whether it has enough room for the cluster upfront, otherwise we end up attempting to set up a cluster and failing. Only in the NO_EMPTY_SIZE loop do we attempt an unclustered allocation, and by then we'll have zeroed the cluster size, so this patch won't stop us from using the block group as a last resort. Signed-off-by: Alexandre Oliva <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent 1b22bad commit 425d831

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/extent-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5278,7 +5278,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
52785278
spin_lock(&block_group->free_space_ctl->tree_lock);
52795279
if (cached &&
52805280
block_group->free_space_ctl->free_space <
5281-
num_bytes + empty_size) {
5281+
num_bytes + empty_cluster + empty_size) {
52825282
spin_unlock(&block_group->free_space_ctl->tree_lock);
52835283
goto loop;
52845284
}

0 commit comments

Comments
 (0)