diff mbox

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

Message ID 1384513869-24525-1-git-send-email-anand.jain@oracle.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Anand Jain Nov. 15, 2013, 11:11 a.m. UTC
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>
---
 v2: accepts G.Baroncelli sugested
     rebased on integration-20131114

 mkfs.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

Comments

Chris Mason Nov. 15, 2013, 11:20 a.m. UTC | #1
Quoting Anand Jain (2013-11-15 06:11:09)
> 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.

Thanks Goffredo for tracking it down, and Anand for the quick fix.

-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/mkfs.c b/mkfs.c
index 4e99c16..de1beed 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1375,14 +1375,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.
@@ -1404,8 +1398,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;