Skip to content

Commit b78d09b

Browse files
Alexandre Olivachrismason-xx
authored andcommitted
Btrfs: reset cluster's max_size when creating bitmap
The field that indicates the size of the largest contiguous chunk of free space in the cluster is not initialized when setting up bitmaps, it's only increased when we find a larger contiguous chunk. We end up retaining a larger value than appropriate for highly-fragmented clusters, which may cause pointless searches for large contiguous groups, and even cause clusters that do not meet the density requirements to be set up. Signed-off-by: Alexandre Oliva <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent f2d0f67 commit b78d09b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/free-space-cache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,6 +2320,7 @@ static int btrfs_bitmap_cluster(struct btrfs_block_group_cache *block_group,
23202320

23212321
if (!found) {
23222322
start = i;
2323+
cluster->max_size = 0;
23232324
found = true;
23242325
}
23252326

0 commit comments

Comments
 (0)