btrfs-progs: for mixed group check opt before default raid profile is enforced

This fixes the regression introduced with the patch

    btrfs-progs: avoid write to the disk before sure to create fs

what happened with this patch is it missed the check to see if the
user has the option set before pushing the defaults.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
master
Anand Jain 2013-11-15 19:11:09 +08:00 committed by Chris Mason
parent 9f0c53f574
commit e9ac73b441
1 changed files with 9 additions and 9 deletions

18
mkfs.c
View File

@ -1373,14 +1373,8 @@ int main(int ac, char **av)
if (is_vol_small(file)) {
printf("SMALL VOLUME: forcing mixed metadata/data groups\n");
mixed = 1;
if (metadata_profile != data_profile) {
if (metadata_profile_opt || data_profile_opt) {
fprintf(stderr,
"With mixed block groups data and metadata profiles must be the same\n");
exit(1);
}
}
}
/*
* Set default profiles according to number of added devices.
* For mixed groups defaults are single/single.
@ -1402,8 +1396,14 @@ int main(int ac, char **av)
}
} else {
u32 best_leafsize = max_t(u32, sysconf(_SC_PAGESIZE), sectorsize);
metadata_profile = 0;
data_profile = 0;
if (metadata_profile_opt || data_profile_opt) {
if (metadata_profile != data_profile) {
fprintf(stderr,
"ERROR: With mixed block groups data and metadata profiles must be the same\n");
exit(1);
}
}
if (!leaf_forced) {
leafsize = best_leafsize;