From 08be5641ce5f4d1393d2e97b3236e49b3fa702bb Mon Sep 17 00:00:00 2001 From: Naohiro Aota Date: Tue, 6 Apr 2021 17:05:53 +0900 Subject: [PATCH] btrfs-progs: simplify arguments of chunk_bytes_by_type() Chunk_bytes_by_type() takes type, calc_size, and ctl as arguments. But the first two can be obtained from the ctl. Let's drop these arguments for simplicity. Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba --- kernel-shared/volumes.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 8ee0fec5..ba702deb 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -897,9 +897,11 @@ int btrfs_add_system_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key, return 0; } -static u64 chunk_bytes_by_type(u64 type, u64 calc_size, - struct alloc_chunk_ctl *ctl) +static u64 chunk_bytes_by_type(struct alloc_chunk_ctl *ctl) { + u64 type = ctl->type; + u64 calc_size = ctl->calc_size; + if (type & (BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_DUP)) return calc_size; else if (type & (BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4)) @@ -1091,9 +1093,7 @@ static void init_alloc_chunk_ctl(struct btrfs_fs_info *info, static int decide_stripe_size_regular(struct alloc_chunk_ctl *ctl) { - u64 chunk_size = chunk_bytes_by_type(ctl->type, ctl->calc_size, ctl); - - if (chunk_size > ctl->max_chunk_size) { + if (chunk_bytes_by_type(ctl) > ctl->max_chunk_size) { ctl->calc_size = ctl->max_chunk_size; ctl->calc_size /= ctl->num_stripes; ctl->calc_size = round_down(ctl->calc_size, BTRFS_STRIPE_LEN); @@ -1158,7 +1158,7 @@ static int create_chunk(struct btrfs_trans_handle *trans, } stripes = &chunk->stripe; - ctl->num_bytes = chunk_bytes_by_type(ctl->type, ctl->calc_size, ctl); + ctl->num_bytes = chunk_bytes_by_type(ctl); index = 0; while (index < ctl->num_stripes) { u64 dev_offset;