linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: raz ben yehuda <raziebe@gmail.com>
To: Neil Brown <neilb@suse.de>, linux raid <linux-raid@vger.kernel.org>
Cc: ofer <ofer@bitband.com>, yaron <yaronp@bitband.com>
Subject: Subject: [PATCH 009/009]: mdadm: 1K chunks for raid0
Date: Tue, 19 May 2009 19:04:57 +0300	[thread overview]
Message-ID: <1242749098.3293.56.camel@raz> (raw)

fix mdadm to pass 1K*n chunks only in the case of raid0.
Commit is stacked on top mdadm.c
commit c8b4de0cccfba18818416f62687e4094a5b83922
Author: NeilBrown <neilb@suse.de>
Date:   Tue May 12 15:25:55 2009 +1000

 mdadm.c |   29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

Signed-off-by: raziebe@gmail.com
---
diff --git a/mdadm.c b/mdadm.c
index 166ea9d..b54e650 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -326,10 +326,25 @@ int main(int argc, char *argv[])
 				exit(2);
 			}
 			chunk = strtol(optarg, &c, 10);
-			if (!optarg[0] || *c || chunk<4 || ((chunk-1)&chunk)) {
-				fprintf(stderr, Name ": invalid chunk/rounding value: %s\n",
-					optarg);
-				exit(2);
+			/* if level is parsed, chunk is probably ok */
+			if (level == 0) {
+				if ((chunk <= 0 || !optarg[0] || *c)) {
+					fprintf(stderr,
+						Name ": invalid chunk/rounding"
+						" value: %s %d\n",
+						optarg, chunk);
+					exit(2);
+				}
+				continue;
+			}
+			if (level != UnSet)
+				if (!optarg[0] || *c || chunk < 4 ||
+					((chunk-1)&chunk)) {
+					fprintf(stderr, Name
+						": invalid chunk"
+						"/rounding value: %s\n",
+						optarg);
+					exit(2);
 			}
 			continue;
 
@@ -411,6 +426,12 @@ int main(int argc, char *argv[])
 					optarg);
 				exit(2);
 			}
+			if (level != 0 && (chunk % 4)) {
+				fprintf(stderr, Name ": raid level %s must"
+					" have power 2 chunk size\n",
+					optarg);
+				exit(2);
+			}
 			ident.level = level;
 			continue;
 



                 reply	other threads:[~2009-05-19 16:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1242749098.3293.56.camel@raz \
    --to=raziebe@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=ofer@bitband.com \
    --cc=yaronp@bitband.com \
    /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).