diff --git a/mkfs.c b/mkfs.c index 5f1411f1..c58ab2f4 100644 --- a/mkfs.c +++ b/mkfs.c @@ -252,7 +252,6 @@ static int create_raid_groups(struct btrfs_trans_handle *trans, u64 metadata_profile, int mixed, struct mkfs_allocation *allocation) { - u64 num_devices = btrfs_super_num_devices(root->fs_info->super_copy); int ret; if (metadata_profile) { @@ -271,7 +270,7 @@ static int create_raid_groups(struct btrfs_trans_handle *trans, BUG_ON(ret); } - if (!mixed && num_devices > 1 && data_profile) { + if (!mixed && data_profile) { ret = create_one_raid_group(trans, root, BTRFS_BLOCK_GROUP_DATA | data_profile, allocation); @@ -1603,7 +1602,7 @@ int main(int ac, char **av) } } ret = test_num_disk_vs_raid(metadata_profile, data_profile, - dev_cnt, mixed); + dev_cnt, mixed, ssd); if (ret) exit(1); diff --git a/utils.c b/utils.c index 13835051..c20966c1 100644 --- a/utils.c +++ b/utils.c @@ -2463,7 +2463,7 @@ static int group_profile_devs_min(u64 flag) } int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile, - u64 dev_cnt, int mixed) + u64 dev_cnt, int mixed, int ssd) { u64 allowed = 0; @@ -2504,11 +2504,9 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile, return 1; } - if (!mixed && (data_profile & BTRFS_BLOCK_GROUP_DUP)) { - fprintf(stderr, - "ERROR: DUP for data is allowed only in mixed mode\n"); - return 1; - } + warning_on(!mixed && (data_profile & BTRFS_BLOCK_GROUP_DUP) && ssd, + "DUP have no effect if your SSD have deduplication function"); + return 0; } diff --git a/utils.h b/utils.h index b6253306..6f3824c5 100644 --- a/utils.h +++ b/utils.h @@ -167,7 +167,7 @@ int test_dev_for_mkfs(char *file, int force_overwrite); int get_label_mounted(const char *mount_path, char *labelp); int get_label_unmounted(const char *dev, char *label); int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile, - u64 dev_cnt, int mixed); + u64 dev_cnt, int mixed, int ssd); int group_profile_max_safe_loss(u64 flags); int is_vol_small(char *file); int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,