linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@cse.unsw.edu.au>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-raid@vger.kernel.org
Subject: [PATCH] md - 4 of 8 - Make sure the size of a raid5/6 array is a multiple of the chunk size.
Date: Fri, 28 May 2004 16:45:25 +1000	[thread overview]
Message-ID: <E1BTb7N-0002To-DB@notabene.cse.unsw.edu.au> (raw)
In-Reply-To: 20040528163700.9426.patches@notabene


Normally the size is chosen as a multiple of the chunk size,
but if the size is explicitly chosen, it might not be.
So we force it.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>

 ----------- Diffstat output ------------
 ./drivers/md/raid5.c     |    3 +++
 ./drivers/md/raid6main.c |    3 +++
 2 files changed, 6 insertions(+)

diff ./drivers/md/raid5.c~current~ ./drivers/md/raid5.c
--- ./drivers/md/raid5.c~current~	2004-05-28 15:48:33.000000000 +1000
+++ ./drivers/md/raid5.c	2004-05-28 15:48:55.000000000 +1000
@@ -1611,6 +1611,9 @@ static int run (mddev_t *mddev)
 	conf->algorithm = mddev->layout;
 	conf->max_nr_stripes = NR_STRIPES;
 
+	/* device size must be a multiple of chunk size */
+	mddev->size &= ~(mddev->chunk_size/1024 -1);
+
 	if (!conf->chunk_size || conf->chunk_size % 4) {
 		printk(KERN_ERR "raid5: invalid chunk size %d for %s\n",
 			conf->chunk_size, mdname(mddev));

diff ./drivers/md/raid6main.c~current~ ./drivers/md/raid6main.c
--- ./drivers/md/raid6main.c~current~	2004-05-28 15:48:33.000000000 +1000
+++ ./drivers/md/raid6main.c	2004-05-28 15:48:55.000000000 +1000
@@ -1775,6 +1775,9 @@ static int run (mddev_t *mddev)
 	conf->algorithm = mddev->layout;
 	conf->max_nr_stripes = NR_STRIPES;
 
+	/* device size must be a multiple of chunk size */
+	mddev->size &= ~(mddev->chunk_size/1024 -1);
+
 	if (conf->raid_disks < 4) {
 		printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 4)\n",
 		       mdname(mddev), conf->raid_disks);

  parent reply	other threads:[~2004-05-28  6:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-28  6:45 [PATCH] md - 0 of 8 - Introduction NeilBrown
2004-05-28  6:45 ` [PATCH] md - 3 of 8 - Allow an md personality to refuse a hot-remove request NeilBrown
2004-05-28 18:35   ` 3ware 7506-8 and Tyan Thunder 2500, S1867, anyone? buggz
2004-05-28  6:45 ` [PATCH] md - 6 of 8 - Abort the resync of raid1 there is only one device NeilBrown
2004-05-28  6:45 ` [PATCH] md - 8 of 8 - Support reshaping raid1 arrays - adding or removing drives NeilBrown
2004-05-28  7:31   ` Andrew Morton
2004-05-28  8:41     ` Neil Brown
2004-05-28 13:32   ` Mario 'BitKoenig' Holbe
2004-05-28 22:47     ` Neil Brown
2004-05-28  6:45 ` [PATCH] md - 1 of 8 - Rationalise device selection in md/multipath NeilBrown
2004-05-28  6:45 ` [PATCH] md - 2 of 8 - Make sure md_check_recovery will remove a faulty device when ->nr_pending hits 0 NeilBrown
2004-05-28  6:45 ` NeilBrown [this message]
2004-05-28  6:45 ` [PATCH] md - 5 of 8 - Handle hot-add for arrays with non-persistent superblocks NeilBrown
2004-05-28  6:45 ` [PATCH] md - 7 of 8 - Allow md arrays to be resized if devices are large enough NeilBrown

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=E1BTb7N-0002To-DB@notabene.cse.unsw.edu.au \
    --to=neilb@cse.unsw.edu.au \
    --cc=akpm@osdl.org \
    --cc=linux-raid@vger.kernel.org \
    /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 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).