btrfs-progs: consolidate num_stripes setting for striping RAID levels

All striping RAID Levels use the same method to set the number of RAID
stripes, so consolidate it.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Johannes Thumshirn 2020-06-10 21:32:58 +09:00 committed by David Sterba
parent b9444efb66
commit 5a1a02d208
1 changed files with 2 additions and 7 deletions

View File

@ -1077,17 +1077,12 @@ static void init_alloc_chunk_ctl(struct btrfs_fs_info *info,
ctl->num_stripes = min(ctl->min_stripes, ctl->total_devs);
break;
case BTRFS_RAID_RAID0:
ctl->num_stripes = min(ctl->max_stripes, ctl->total_devs);
break;
case BTRFS_RAID_RAID10:
ctl->num_stripes = min(ctl->max_stripes, ctl->total_devs);
ctl->num_stripes &= ~(u32)1;
break;
case BTRFS_RAID_RAID5:
ctl->num_stripes = min(ctl->max_stripes, ctl->total_devs);
break;
case BTRFS_RAID_RAID6:
ctl->num_stripes = min(ctl->max_stripes, ctl->total_devs);
if (type == BTRFS_RAID_RAID10)
ctl->num_stripes &= ~(u32)1;
break;
default:
break;