linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Subject: [PATCH 006/009]: raid1: chunk size check in run
@ 2009-05-19 16:04 raz ben yehuda
  2009-05-20  1:45 ` Neil Brown
  0 siblings, 1 reply; 6+ messages in thread
From: raz ben yehuda @ 2009-05-19 16:04 UTC (permalink / raw)
  To: linux raid, Neil Brown; +Cc: yaron, ofer

have raid1 check chunk size in run method instead of in md
 raid1.c |    9 +++++++++
 1 file changed, 9 insertions(+)
Signed-off-by: raziebe@gmail.com
---
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 2c8d9e6..8609506 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1942,6 +1942,15 @@ static int run(mddev_t *mddev)
 		       mdname(mddev), mddev->level);
 		goto out;
 	}
+	/*
+	 * chunk-size has to be a power of 2
+	 */
+	if ((1 << ffz(~mddev->chunk_size)) != mddev->chunk_size) {
+		printk(KERN_ERR "%s chunk_size of %d not valid\n",
+			mdname(mddev),
+			mddev->chunk_size);
+		return -EINVAL;
+	}
 	if (mddev->reshape_position != MaxSector) {
 		printk("raid1: %s: reshape_position set but not supported\n",
 		       mdname(mddev));



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-05-21 13:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-19 16:04 Subject: [PATCH 006/009]: raid1: chunk size check in run raz ben yehuda
2009-05-20  1:45 ` Neil Brown
2009-05-20 13:50   ` raz ben yehuda
2009-05-21  3:11     ` Neil Brown
2009-05-21 13:32       ` raz ben yehuda
2009-05-21 11:33         ` Neil Brown

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