linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Subject: [PATCH 009/009]: mdadm: 1K chunks for raid0
@ 2009-05-19 16:04 raz ben yehuda
  0 siblings, 0 replies; only message in thread
From: raz ben yehuda @ 2009-05-19 16:04 UTC (permalink / raw)
  To: Neil Brown, linux raid; +Cc: ofer, yaron

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;
 



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-19 16:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-19 16:04 Subject: [PATCH 009/009]: mdadm: 1K chunks for raid0 raz ben yehuda

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