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

have raid10 check chunk size in run method instead of in md
 raid10.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Signed-off-by: raziebe@gmail.com
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 2405add..52ad64e 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2055,7 +2055,15 @@ static int run(mddev_t *mddev)
 		       "at least PAGE_SIZE(%ld).\n", PAGE_SIZE);
 		return -EINVAL;
 	}
-
+	/*
+	 * 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;
+	}
 	nc = mddev->layout & 255;
 	fc = (mddev->layout >> 8) & 255;
 	fo = mddev->layout & (1<<16);



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

* Subject: [PATCH 007/009]: raid10: chunk size check in run
@ 2009-05-19 16:09 raz ben yehuda
  0 siblings, 0 replies; 6+ messages in thread
From: raz ben yehuda @ 2009-05-19 16:09 UTC (permalink / raw)
  To: neilb, linux raid; +Cc: ofer, yaron

have raid10 check chunk size in run method instead of in md
 raid10.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Signed-off-by: raziebe@gmail.com
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 2405add..52ad64e 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2055,7 +2055,15 @@ static int run(mddev_t *mddev)
 		       "at least PAGE_SIZE(%ld).\n", PAGE_SIZE);
 		return -EINVAL;
 	}
-
+	/*
+	 * 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;
+	}
 	nc = mddev->layout & 255;
 	fc = (mddev->layout >> 8) & 255;
 	fo = mddev->layout & (1<<16);



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

* Subject: [PATCH 007/009]: raid10: chunk size check in run
@ 2009-05-19 16:10 raz ben yehuda
  0 siblings, 0 replies; 6+ messages in thread
From: raz ben yehuda @ 2009-05-19 16:10 UTC (permalink / raw)
  To: neilb, linux raid; +Cc: ofer, yaron

have raid10 check chunk size in run method instead of in md
 raid10.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Signed-off-by: raziebe@gmail.com
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 2405add..52ad64e 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2055,7 +2055,15 @@ static int run(mddev_t *mddev)
 		       "at least PAGE_SIZE(%ld).\n", PAGE_SIZE);
 		return -EINVAL;
 	}
-
+	/*
+	 * 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;
+	}
 	nc = mddev->layout & 255;
 	fc = (mddev->layout >> 8) & 255;
 	fo = mddev->layout & (1<<16);



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

* Subject: [PATCH 007/009]: raid10: chunk size check in run
@ 2009-05-19 16:10 raz ben yehuda
  0 siblings, 0 replies; 6+ messages in thread
From: raz ben yehuda @ 2009-05-19 16:10 UTC (permalink / raw)
  To: Neil Brown, linux raid; +Cc: ofer, yaron

have raid10 check chunk size in run method instead of in md
 raid10.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Signed-off-by: raziebe@gmail.com
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 2405add..52ad64e 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2055,7 +2055,15 @@ static int run(mddev_t *mddev)
 		       "at least PAGE_SIZE(%ld).\n", PAGE_SIZE);
 		return -EINVAL;
 	}
-
+	/*
+	 * 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;
+	}
 	nc = mddev->layout & 255;
 	fc = (mddev->layout >> 8) & 255;
 	fo = mddev->layout & (1<<16);



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

* Subject: [PATCH 007/009]: raid10: chunk size check in run
@ 2009-05-19 16:10 raz ben yehuda
  0 siblings, 0 replies; 6+ messages in thread
From: raz ben yehuda @ 2009-05-19 16:10 UTC (permalink / raw)
  To: Neil Brown, linux raid; +Cc: ofer, yaron

have raid10 check chunk size in run method instead of in md
 raid10.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Signed-off-by: raziebe@gmail.com
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 2405add..52ad64e 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2055,7 +2055,15 @@ static int run(mddev_t *mddev)
 		       "at least PAGE_SIZE(%ld).\n", PAGE_SIZE);
 		return -EINVAL;
 	}
-
+	/*
+	 * 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;
+	}
 	nc = mddev->layout & 255;
 	fc = (mddev->layout >> 8) & 255;
 	fo = mddev->layout & (1<<16);



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

* Re: Subject: [PATCH 007/009]: raid10: chunk size check in run
  2009-05-19 16:08 raz ben yehuda
@ 2009-05-20  1:41 ` Neil Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Neil Brown @ 2009-05-20  1:41 UTC (permalink / raw)
  To: raz ben yehuda; +Cc: linux raid, ofer, yaron

On Tuesday May 19, raziebe@gmail.com wrote:
> have raid10 check chunk size in run method instead of in md
>  raid10.c |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> Signed-off-by: raziebe@gmail.com
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 2405add..52ad64e 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -2055,7 +2055,15 @@ static int run(mddev_t *mddev)
>  		       "at least PAGE_SIZE(%ld).\n", PAGE_SIZE);
>  		return -EINVAL;
>  	}
> -
> +	/*
> +	 * 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;
> +	}
>  	nc = mddev->layout & 255;
>  	fc = (mddev->layout >> 8) & 255;
>  	fo = mddev->layout & (1<<16);
> 

I combined this with the other chunk_size check in run, so there
is only the one printk.

Thanks,
NeilBrown

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

end of thread, other threads:[~2009-05-20  1:41 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:09 Subject: [PATCH 007/009]: raid10: chunk size check in run raz ben yehuda
  -- strict thread matches above, loose matches on Subject: below --
2009-05-19 16:10 raz ben yehuda
2009-05-19 16:10 raz ben yehuda
2009-05-19 16:10 raz ben yehuda
2009-05-19 16:08 raz ben yehuda
2009-05-20  1:41 ` 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).