diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2016-09-06 17:35:06 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-09-21 11:47:31 +0200 |
commit | 53c4e289c237e4f1008fdec54256e81c24c8882a (patch) | |
tree | 0fd4f494f50d58b141f762078a9fa520fd63378a /utils.c | |
parent | c2f3212502210427c5f17e66fbb30ad89826fbd7 (diff) |
btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup
For RAID5, 2 devices setup is just RAID1 with more overhead.
For RAID6, 3 devices setup is RAID1 with 3 copies, not what most user
want.
So warn user at mkfs time for such case, and add explain in man pages.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -3280,6 +3280,7 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile, u64 dev_cnt, int mixed, int ssd) { u64 allowed = 0; + u64 profile = metadata_profile | data_profile; switch (dev_cnt) { default: @@ -3294,8 +3295,7 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile, allowed |= BTRFS_BLOCK_GROUP_DUP; } - if (dev_cnt > 1 && - ((metadata_profile | data_profile) & BTRFS_BLOCK_GROUP_DUP)) { + if (dev_cnt > 1 && profile & BTRFS_BLOCK_GROUP_DUP) { warning("DUP is not recommended on filesystem with multiple devices"); } if (metadata_profile & ~allowed) { @@ -3315,6 +3315,12 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile, return 1; } + if (dev_cnt == 3 && profile & BTRFS_BLOCK_GROUP_RAID6) { + warning("RAID6 is not recommended on filesystem with 3 devices only"); + } + if (dev_cnt == 2 && profile & BTRFS_BLOCK_GROUP_RAID5) { + warning("RAID5 is not recommended on filesystem with 2 devices only"); + } warning_on(!mixed && (data_profile & BTRFS_BLOCK_GROUP_DUP) && ssd, "DUP may not actually lead to 2 copies on the device, see manual page"); |