Skip to content

Commit 3849c80

Browse files
naotakdave
authored andcommitted
btrfs: zoned: refine extent allocator hint selection
The hint block group selection in the extent allocator is wrong in the first place, as it can select the dedicated data relocation block group for the normal data allocation. Since we separated the normal data space_info and the data relocation space_info, we can easily identify a block group is for data relocation or not. Do not choose it for the normal data allocation. Signed-off-by: Naohiro Aota <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]>
1 parent 1f22f4d commit 3849c80

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/btrfs/extent-tree.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4297,7 +4297,8 @@ static int prepare_allocation_clustered(struct btrfs_fs_info *fs_info,
42974297
}
42984298

42994299
static int prepare_allocation_zoned(struct btrfs_fs_info *fs_info,
4300-
struct find_free_extent_ctl *ffe_ctl)
4300+
struct find_free_extent_ctl *ffe_ctl,
4301+
struct btrfs_space_info *space_info)
43014302
{
43024303
if (ffe_ctl->for_treelog) {
43034304
spin_lock(&fs_info->treelog_bg_lock);
@@ -4321,6 +4322,7 @@ static int prepare_allocation_zoned(struct btrfs_fs_info *fs_info,
43214322
u64 avail = block_group->zone_capacity - block_group->alloc_offset;
43224323

43234324
if (block_group_bits(block_group, ffe_ctl->flags) &&
4325+
block_group->space_info == space_info &&
43244326
avail >= ffe_ctl->num_bytes) {
43254327
ffe_ctl->hint_byte = block_group->start;
43264328
break;
@@ -4342,7 +4344,7 @@ static int prepare_allocation(struct btrfs_fs_info *fs_info,
43424344
return prepare_allocation_clustered(fs_info, ffe_ctl,
43434345
space_info, ins);
43444346
case BTRFS_EXTENT_ALLOC_ZONED:
4345-
return prepare_allocation_zoned(fs_info, ffe_ctl);
4347+
return prepare_allocation_zoned(fs_info, ffe_ctl, space_info);
43464348
default:
43474349
BUG();
43484350
}

0 commit comments

Comments
 (0)