]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: zoned: directly call do_zone_finish() from btrfs_zone_finish_endio_workfn()
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Tue, 22 Jul 2025 11:39:10 +0000 (13:39 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 22 Sep 2025 08:54:30 +0000 (10:54 +0200)
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>
fs/btrfs/zoned.c

index efc2a81f50e55180f584d4867e54f3f224a1b48e..c5c4e512a58683ccc9d3975daa53a110ac561c17 100644 (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);
 }