Commit 49cc180c authored by David Sterba's avatar David Sterba

btrfs: raid56: allow the exact minimum number of devices for balance convert

The minimum number of devices for RAID5 is 2, though this is only a bit
expensive RAID1, and for RAID6 it's 3, which is a triple copy that works
only 3 devices.

mkfs.btrfs allows that and mounting such filesystem also works, so the
conversion via balance filters is inconsistent with the others and we
should not prevent it.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0ee5f8ae
...@@ -4080,11 +4080,12 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, ...@@ -4080,11 +4080,12 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
allowed = BTRFS_AVAIL_ALLOC_BIT_SINGLE | BTRFS_BLOCK_GROUP_DUP; allowed = BTRFS_AVAIL_ALLOC_BIT_SINGLE | BTRFS_BLOCK_GROUP_DUP;
if (num_devices > 1) if (num_devices > 1)
allowed |= (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1); allowed |= (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1);
if (num_devices > 2) if (num_devices >= 2)
allowed |= BTRFS_BLOCK_GROUP_RAID5; allowed |= BTRFS_BLOCK_GROUP_RAID5;
if (num_devices >= 3)
allowed |= BTRFS_BLOCK_GROUP_RAID6;
if (num_devices > 3) if (num_devices > 3)
allowed |= (BTRFS_BLOCK_GROUP_RAID10 | allowed |= BTRFS_BLOCK_GROUP_RAID10;
BTRFS_BLOCK_GROUP_RAID6);
if (validate_convert_profile(&bctl->data, allowed)) { if (validate_convert_profile(&bctl->data, allowed)) {
int index = btrfs_bg_flags_to_raid_index(bctl->data.target); int index = btrfs_bg_flags_to_raid_index(bctl->data.target);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment