提交 2e654e4b 编写于 作者: N Naohiro Aota 提交者: David Sterba

btrfs: zoned: activate block group on allocation

Activate a block group when trying to allocate an extent from it. We check
read-only case and no space left case before trying to activate a block
group not to consume the number of active zones uselessly.
Signed-off-by: NNaohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 68a384b5
...@@ -3773,6 +3773,18 @@ static int do_allocation_zoned(struct btrfs_block_group *block_group, ...@@ -3773,6 +3773,18 @@ static int do_allocation_zoned(struct btrfs_block_group *block_group,
if (skip) if (skip)
return 1; return 1;
/* Check RO and no space case before trying to activate it */
spin_lock(&block_group->lock);
if (block_group->ro ||
block_group->alloc_offset == block_group->zone_capacity) {
spin_unlock(&block_group->lock);
return 1;
}
spin_unlock(&block_group->lock);
if (!btrfs_zone_activate(block_group))
return 1;
spin_lock(&space_info->lock); spin_lock(&space_info->lock);
spin_lock(&block_group->lock); spin_lock(&block_group->lock);
spin_lock(&fs_info->treelog_bg_lock); spin_lock(&fs_info->treelog_bg_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册