linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz, chris.mason@fusionio.com
Subject: [PATCH v2] btrfs-progs: for mixed group check opt before default raid profile is enforced
Date: Fri, 15 Nov 2013 19:11:09 +0800	[thread overview]
Message-ID: <1384513869-24525-1-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1384490079-19872-1-git-send-email-anand.jain@oracle.com>

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(-)

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;
-- 
1.7.1


  parent reply	other threads:[~2013-11-15 11:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-15  4:34 [PATCH] btrfs-progs: for mixed group check opt before default raid profile is enforced Anand Jain
2013-11-15  7:16 ` Goffredo Baroncelli
2013-11-15 11:11 ` Anand Jain [this message]
2013-11-15 11:20   ` [PATCH v2] " Chris Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384513869-24525-1-git-send-email-anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=chris.mason@fusionio.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).