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

have raid5 check chunk size in run method instead of in md
 raid5.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Signed-Off-by:raziebe@gmail.com
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index e4608d6..0c688ee 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4452,7 +4452,15 @@ static int run(mddev_t *mddev)
 	raid5_conf_t *conf;
 	int working_disks = 0;
 	mdk_rdev_t *rdev;
-
+	/*
+	 * 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) {
 		/* Check that we can continue the reshape.
 		 * Currently only disks can change, it must



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

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

On Tuesday May 19, raziebe@gmail.com wrote:
> have raid5 check chunk size in run method instead of in md
>  raid5.c |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> Signed-Off-by:raziebe@gmail.com
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index e4608d6..0c688ee 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -4452,7 +4452,15 @@ static int run(mddev_t *mddev)
>  	raid5_conf_t *conf;
>  	int working_disks = 0;
>  	mdk_rdev_t *rdev;
> -
> +	/*
> +	 * 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) {
>  		/* Check that we can continue the reshape.
>  		 * Currently only disks can change, it must
> 

I've moved this test from 'run' to 'setup_conf' which is called by run
and also by the reshape code, and already has a test on chunk_size.

Thanks,
NeilBrown

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

end of thread, other threads:[~2009-05-20  1:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-19 16:07 Subject: [PATCH 008/009]: raid5: chunk size check in run raz ben yehuda
2009-05-20  1:39 ` 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).