btrfs-progs: use btrfs_bg_type_to_nparity in calc_chunk_size

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-10-07 00:07:47 +02:00
parent 754436f1ea
commit a5d4fff0df
1 changed files with 2 additions and 4 deletions

View File

@ -816,10 +816,8 @@ static u64 calc_chunk_size(struct chunk_info *ci)
return ci->size ;
else if (ci->type & BTRFS_BLOCK_GROUP_DUP)
return ci->size ;
else if (ci->type & BTRFS_BLOCK_GROUP_RAID5)
return ci->size / (ci->num_stripes -1);
else if (ci->type & BTRFS_BLOCK_GROUP_RAID6)
return ci->size / (ci->num_stripes -2);
else if (ci->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
return ci->size / (ci->num_stripes - btrfs_bg_type_to_nparity(ci->type));
else if (ci->type & BTRFS_BLOCK_GROUP_RAID10)
return ci->size / (ci->num_stripes / 2);
return ci->size;