]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
btrfs: remove bytes_used argument from btrfs_make_block_group()
authorFilipe Manana <fdmanana@suse.com>
Tue, 21 Mar 2023 11:13:45 +0000 (11:13 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Apr 2023 16:01:19 +0000 (18:01 +0200)
The only caller of btrfs_make_block_group() always passes 0 as the value
for the bytes_used argument, so remove it.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
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/block-group.c
fs/btrfs/block-group.h
fs/btrfs/volumes.c

index 46a8ca24afaa8efd6a04c5699af0770e0e2b3323..bb6024c17db4626f7dffae65210d08620da883af 100644 (file)
@@ -2672,7 +2672,7 @@ static u64 calculate_global_root_id(struct btrfs_fs_info *fs_info, u64 offset)
 }
 
 struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *trans,
-                                                u64 bytes_used, u64 type,
+                                                u64 type,
                                                 u64 chunk_offset, u64 size)
 {
        struct btrfs_fs_info *fs_info = trans->fs_info;
@@ -2687,7 +2687,6 @@ struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *tran
 
        cache->length = size;
        set_free_space_tree_thresholds(cache);
-       cache->used = bytes_used;
        cache->flags = type;
        cache->cached = BTRFS_CACHE_FINISHED;
        cache->global_root_id = calculate_global_root_id(fs_info, cache->start);
@@ -2738,9 +2737,7 @@ struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *tran
 
 #ifdef CONFIG_BTRFS_DEBUG
        if (btrfs_should_fragment_free_space(cache)) {
-               u64 new_bytes_used = size - bytes_used;
-
-               cache->space_info->bytes_used += new_bytes_used >> 1;
+               cache->space_info->bytes_used += size >> 1;
                fragment_free_space(cache);
        }
 #endif
index 6e4a0b429ac312aca59e84562670e411877e4581..db729ad7315bf43c8f10642f7b2a2f9b5da2813a 100644 (file)
@@ -302,7 +302,7 @@ void btrfs_reclaim_bgs(struct btrfs_fs_info *fs_info);
 void btrfs_mark_bg_to_reclaim(struct btrfs_block_group *bg);
 int btrfs_read_block_groups(struct btrfs_fs_info *info);
 struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *trans,
-                                                u64 bytes_used, u64 type,
+                                                u64 type,
                                                 u64 chunk_offset, u64 size);
 void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans);
 int btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
index 4714d371b1b96f8dee8c379ca694a0decd54ed74..eead4a1f53b7f59139b498794ddcfd7da9f06e92 100644 (file)
@@ -5437,7 +5437,7 @@ static struct btrfs_block_group *create_chunk(struct btrfs_trans_handle *trans,
        }
        write_unlock(&em_tree->lock);
 
-       block_group = btrfs_make_block_group(trans, 0, type, start, ctl->chunk_size);
+       block_group = btrfs_make_block_group(trans, type, start, ctl->chunk_size);
        if (IS_ERR(block_group))
                goto error_del_extent;