btrfs: zoned: directly call do_zone_finish() from btrfs_zone_finish_endio_workfn()

When btrfs_zone_finish_endio_workfn() is calling btrfs_zone_finish_endio()
it already has a pointer to the block group. Furthermore
btrfs_zone_finish_endio() does additional checks if the block group can be
finished or not.

But in the context of btrfs_zone_finish_endio_workfn() only the actual
call to do_zone_finish() is of interest, as the skipping condition when
there is still room to allocate from the block group cannot be checked.

Directly call do_zone_finish() on the block group.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Johannes Thumshirn 2025-07-22 13:39:10 +02:00 committed by David Sterba
parent 669d38bf58
commit 3d16abf6c8

View File

@ -2488,12 +2488,16 @@ out:
static void btrfs_zone_finish_endio_workfn(struct work_struct *work)
{
int ret;
struct btrfs_block_group *bg =
container_of(work, struct btrfs_block_group, zone_finish_work);
wait_on_extent_buffer_writeback(bg->last_eb);
free_extent_buffer(bg->last_eb);
btrfs_zone_finish_endio(bg->fs_info, bg->start, bg->length);
ret = do_zone_finish(bg, true);
if (ret)
btrfs_handle_fs_error(bg->fs_info, ret,
"Failed to finish block-group's zone");
btrfs_put_block_group(bg);
}