Skip to contentSkip to conversation

Subject: [ mdadm PATCH 6/6] : mdadm to support 1K chunks

PATCH raz ben yehuda 1 participant 1 message May 18, 2009 MD RAID

lore
Share & tools
lore
#0 lore raw

fix mdadm to path 1K*n chunks only in the case of raid0. Commit is stacked on top mdadm.c
commit c8b4de0cccfba18818416f62687e4094a5b83922

Author: NeilBrown <[email protected]>
Date:   Tue May 12 15:25:55 2009 +1000
 mdadm.c |   29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)
Signed-off-by [email protected]

---

mdadm.c +25 -4
index 166ea9d..b54e650 100644
@@ -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;