mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-19 12:10:50 +00:00
btrfs-progs: consolidate setting of RAID1 stripes
All 3 different RAID1 profiles use the same calculation mehod for the number of used stripes. Now that we do table lookups fo rmost of the allocation control parameters, we can consolidate all 3 RAID1 profiles into a single branch for the calculation. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
9b591da1f6
commit
63975f0693
17
volumes.c
17
volumes.c
@ -1129,20 +1129,9 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
|
||||
ctl.max_stripes = BTRFS_MAX_DEVS(info);
|
||||
}
|
||||
}
|
||||
if (ctl.type == BTRFS_RAID_RAID1) {
|
||||
ctl.min_stripes = btrfs_raid_profile_table[ctl.type].min_stripes;
|
||||
ctl.num_stripes = min(ctl.min_stripes, ctl.total_devs);
|
||||
if (ctl.num_stripes < ctl.min_stripes)
|
||||
return -ENOSPC;
|
||||
}
|
||||
if (ctl.type == BTRFS_RAID_RAID1C3) {
|
||||
ctl.min_stripes = btrfs_raid_profile_table[ctl.type].min_stripes;
|
||||
ctl.num_stripes = min(ctl.min_stripes, ctl.total_devs);
|
||||
if (ctl.num_stripes < ctl.min_stripes)
|
||||
return -ENOSPC;
|
||||
}
|
||||
if (ctl.type == BTRFS_RAID_RAID1C4) {
|
||||
ctl.min_stripes = btrfs_raid_profile_table[ctl.type].min_stripes;
|
||||
if (ctl.type == BTRFS_RAID_RAID1 ||
|
||||
ctl.type == BTRFS_RAID_RAID1C3 ||
|
||||
ctl.type == BTRFS_RAID_RAID1C4) {
|
||||
ctl.num_stripes = min(ctl.min_stripes, ctl.total_devs);
|
||||
if (ctl.num_stripes < ctl.min_stripes)
|
||||
return -ENOSPC;
|
||||
|
Loading…
Reference in New Issue
Block a user