From: Johannes Thumshirn Date: Tue, 22 Jul 2025 11:39:10 +0000 (+0200) Subject: btrfs: zoned: directly call do_zone_finish() from btrfs_zone_finish_endio_workfn() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3d16abf6c88ae20cc4168756e77ad270a9b37182;p=users%2Fhch%2Fmisc.git 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 Signed-off-by: Johannes Thumshirn Signed-off-by: David Sterba --- diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index efc2a81f50e5..c5c4e512a586 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -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); }