From: NeilBrown <neilb@suse.de>
To: linux-raid@vger.kernel.org
Subject: [md PATCH 2/6] md/raid5: enhance raid5_size to work correctly with negative delta_disks
Date: Tue, 24 Mar 2009 19:53:32 +1100 [thread overview]
Message-ID: <20090324085332.15383.41510.stgit@notabene.brown> (raw)
In-Reply-To: <20090324084629.15383.10271.stgit@notabene.brown>
This is the first of four patches which combine to allow md/raid5 to
reduce the number of devices in the array by restriping the data over
a subset of the devices.
If the number of disks in a raid4/5/6 is being reduced, then the
default size must be based on the new number, not the old number
of devices.
In general, it should be based on the smaller of new and old.
Signed-off-by: NeilBrown <neilb@suse.de>
---
drivers/md/raid5.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 3b71f01..74e89c1 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4169,8 +4169,13 @@ raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks)
if (!sectors)
sectors = mddev->dev_sectors;
- if (!raid_disks)
- raid_disks = conf->previous_raid_disks;
+ if (!raid_disks) {
+ /* size is defined by the smallest of previous and new size */
+ if (conf->raid_disks < conf->previous_raid_disks)
+ raid_disks = conf->raid_disks;
+ else
+ raid_disks = conf->previous_raid_disks;
+ }
sectors &= ~((sector_t)mddev->chunk_size/512 - 1);
return sectors * (raid_disks - conf->max_degraded);
prev parent reply other threads:[~2009-03-24 8:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-24 8:53 [md PATCH 0/6] Reduce the number of devices in RAID4/5/6 NeilBrown
2009-03-24 8:53 ` [md PATCH 1/6] md/raid5: drop qd_idx from r6_state NeilBrown
2009-03-24 8:53 ` [md PATCH 5/6] md: allow number of drives in raid5 to be reduced NeilBrown
2009-03-27 16:19 ` Andre Noll
2009-03-27 19:39 ` NeilBrown
2009-03-24 8:53 ` [md PATCH 6/6] Documentation/md.txt update NeilBrown
2009-03-27 16:19 ` Andre Noll
2009-03-27 19:43 ` NeilBrown
2009-03-24 8:53 ` [md PATCH 4/6] md/raid5: change reshape-progress measurement to cope with reshaping backwards NeilBrown
2009-03-27 16:19 ` Andre Noll
2009-03-27 19:54 ` NeilBrown
2009-03-30 9:09 ` Andre Noll
[not found] ` <49CE1713.9070707@tmr.com>
2009-03-30 9:20 ` Andre Noll
2009-03-24 8:53 ` [md PATCH 3/6] md: add explicit method to signal the end of a reshape NeilBrown
2009-03-24 8:53 ` NeilBrown [this message]
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=20090324085332.15383.41510.stgit@notabene.brown \
--to=neilb@suse.de \
--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).