]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: remove fs_info argument from calc_available_free_space()
authorFilipe Manana <fdmanana@suse.com>
Mon, 13 Oct 2025 16:39:21 +0000 (17:39 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 24 Nov 2025 20:59:09 +0000 (21:59 +0100)
We don't need it since we can grab fs_info from the given space_info.
So remove the fs_info argument.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Anand Jain <asj@kernel.org>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/space-info.c

index 8d3459b9f8dddcd66b83638a7197b950cf20420f..97e5007c78ed259cec95ffd252b4bacecf26627a 100644 (file)
@@ -421,10 +421,10 @@ static u64 calc_effective_data_chunk_size(struct btrfs_fs_info *fs_info)
        return min_t(u64, data_chunk_size, SZ_1G);
 }
 
-static u64 calc_available_free_space(struct btrfs_fs_info *fs_info,
-                         const struct btrfs_space_info *space_info,
-                         enum btrfs_reserve_flush_enum flush)
+static u64 calc_available_free_space(const struct btrfs_space_info *space_info,
+                                    enum btrfs_reserve_flush_enum flush)
 {
+       struct btrfs_fs_info *fs_info = space_info->fs_info;
        u64 profile;
        u64 avail;
        u64 data_chunk_size;
@@ -502,7 +502,7 @@ int btrfs_can_overcommit(struct btrfs_fs_info *fs_info,
                return 0;
 
        used = btrfs_space_info_used(space_info, true);
-       avail = calc_available_free_space(fs_info, space_info, flush);
+       avail = calc_available_free_space(space_info, flush);
 
        if (used + bytes < space_info->total_bytes + avail)
                return 1;
@@ -909,8 +909,7 @@ static u64 btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info,
 
        lockdep_assert_held(&space_info->lock);
 
-       avail = calc_available_free_space(fs_info, space_info,
-                                         BTRFS_RESERVE_FLUSH_ALL);
+       avail = calc_available_free_space(space_info, BTRFS_RESERVE_FLUSH_ALL);
        used = btrfs_space_info_used(space_info, true);
 
        /*
@@ -992,8 +991,7 @@ static bool need_preemptive_reclaim(struct btrfs_fs_info *fs_info,
         * much delalloc we need for the background flusher to kick in.
         */
 
-       thresh = calc_available_free_space(fs_info, space_info,
-                                          BTRFS_RESERVE_FLUSH_ALL);
+       thresh = calc_available_free_space(space_info, BTRFS_RESERVE_FLUSH_ALL);
        used = space_info->bytes_used + space_info->bytes_reserved +
               space_info->bytes_readonly + global_rsv_size;
        if (used < space_info->total_bytes)