From 17078525e5be48381a35068535feb9adb36635f3 Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Tue, 20 Jan 2026 11:42:43 +0000 Subject: [PATCH] btrfs: make load_block_group_size_class() return void There's no point in returning anything since determining and setting a size class for a block group is an optimization, not something critical. The only caller of load_block_group_size_class() (the caching thread) does not do anything with the return value anyway, exactly because having a size class is just an optimization and it can always be set later when adding reserved bytes to a block group (btrfs_add_reserved_bytes()). Reviewed-by: Johannes Thumshirn Reviewed-by: Qu Wenruo Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/block-group.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 022c77f8d0e2d..20dd4a3d9961c 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -673,27 +673,29 @@ static int sample_block_group_extent_item(struct btrfs_caching_control *caching_ * 3, we can either read every file extent, or admit that this is best effort * anyway and try to stay fast. * - * Returns: 0 on success, negative error code on error. + * No errors are returned since failing to determine the size class is not a + * critical error, size classes are just an optimization. */ -static int load_block_group_size_class(struct btrfs_caching_control *caching_ctl, - struct btrfs_block_group *block_group) +static void load_block_group_size_class(struct btrfs_caching_control *caching_ctl, + struct btrfs_block_group *block_group) { struct btrfs_fs_info *fs_info = block_group->fs_info; struct btrfs_key key; int i; u64 min_size = block_group->length; enum btrfs_block_group_size_class size_class = BTRFS_BG_SZ_NONE; - int ret; if (!btrfs_block_group_should_use_size_class(block_group)) - return 0; + return; lockdep_assert_held(&caching_ctl->mutex); lockdep_assert_held_read(&fs_info->commit_root_sem); for (i = 0; i < 5; ++i) { + int ret; + ret = sample_block_group_extent_item(caching_ctl, block_group, i, 5, &key); if (ret < 0) - goto out; + return; if (ret > 0) continue; min_size = min_t(u64, min_size, key.offset); @@ -704,8 +706,6 @@ static int load_block_group_size_class(struct btrfs_caching_control *caching_ctl block_group->size_class = size_class; spin_unlock(&block_group->lock); } -out: - return ret; } static int load_extent_tree_free(struct btrfs_caching_control *caching_ctl) -- 2.47.3