All of lore.kernel.org
 help / color / mirror / Atom feed
From: raz ben yehuda <raziebe@gmail.com>
To: neilb@suse.de, linux raid <linux-raid@vger.kernel.org>
Cc: ofer <ofer@bitband.com>, yaron <yaronp@bitband.com>
Subject: Subject: [PATCH 007/009]: raid10: chunk size check in run
Date: Tue, 19 May 2009 19:10:03 +0300	[thread overview]
Message-ID: <1242749403.3293.87.camel@raz> (raw)

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



             reply	other threads:[~2009-05-19 16:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-19 16:10 raz ben yehuda [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-05-19 16:10 Subject: [PATCH 007/009]: raid10: chunk size check in run raz ben yehuda
2009-05-19 16:10 raz ben yehuda
2009-05-19 16:09 raz ben yehuda
2009-05-19 16:08 raz ben yehuda
2009-05-20  1:41 ` Neil Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1242749403.3293.87.camel@raz \
    --to=raziebe@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=ofer@bitband.com \
    --cc=yaronp@bitband.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.