From: Neil Brown <neilb@suse.de>
To: "Trela, Maciej" <Maciej.Trela@intel.com>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
"Williams, Dan J" <dan.j.williams@intel.com>,
"Ciechanowski, Ed" <ed.ciechanowski@intel.com>
Subject: Re: [PATCH 1/3] md:Add support for Raid0->Raid5 takeover
Date: Mon, 1 Feb 2010 10:58:06 +1100 [thread overview]
Message-ID: <20100201105806.62e4dd94@notabene.brown> (raw)
In-Reply-To: <F2A46F4A087B8547923AD59C289DC90E01D16226@irsmsx002.ger.corp.intel.com>
On Fri, 29 Jan 2010 14:54:03 +0000
"Trela, Maciej" <Maciej.Trela@intel.com> wrote:
> Hello Neil, I'm sending patches with new takeover transitions proposal:
> 0->5(4), 5(4)->0, 10->0, 0->10.
>
> Regards,
> Maciek
>
>
> Signed-off-by: Maciej Trela <maciej.trela@intel.com>
> ---
> drivers/md/raid5.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 50 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index e84204e..0fe78ea 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -5614,6 +5614,39 @@ static void raid5_quiesce(mddev_t *mddev, int state)
> }
>
>
> +static void *raid5_takeover_raid0(mddev_t *mddev)
> +{
> + int chunksect;
> +
> + if (mddev->degraded > 0) {
> + printk(KERN_ERR "ERROR: Raid0 with degraded disks!: %d\n", mddev->degraded);
> + return ERR_PTR(-EINVAL);
> + }
> +
> + chunksect = 64*2; /* 64K by default */
> +
> + /* The array must be an exact multiple of chunksize */
> + while (chunksect && (mddev->array_sectors & (chunksect-1)))
> + chunksect >>= 1;
> +
> + if ((chunksect<<9) < STRIPE_SIZE) {
> + /* array size does not allow a suitable chunk size */
> + return ERR_PTR(-EINVAL);
> + }
This is wrong. The chunksize for RAID5 must be exactly the same as the
chunksize for RAID0. There is no place for guessing.
> +
> + mddev->new_level = 5;
> + mddev->new_layout = ALGORITHM_PARITY_N;
> + mddev->new_chunk_sectors = chunksect;
> + mddev->degraded++;
> + mddev->raid_disks++;
> + mddev->delta_disks++;
> + /* make sure it will be not marked as dirty */
> + mddev->recovery_cp = MaxSector;
> +
> + return setup_conf(mddev);
> +}
> +
> +
> static void *raid5_takeover_raid1(mddev_t *mddev)
> {
> int chunksect;
> @@ -5737,12 +5770,29 @@ static int raid6_check_reshape(mddev_t *mddev)
>
> static void *raid5_takeover(mddev_t *mddev)
> {
> + mdk_rdev_t *rdev;
> + sector_t sectors, dev_sectors;
> +
> /* raid5 can take over:
> * raid0 - if all devices are the same - make it a raid4 layout
> * raid1 - if there are two drives. We need to know the chunk size
> * raid4 - trivial - just use a raid4 layout.
> * raid6 - Providing it is a *_6 layout
> */
> + if (mddev->level == 0) {
> + /* make sure all devices are the same (only one zone is supported) */
> + sectors = mddev->dev_sectors;
> + sector_div(sectors, mddev->chunk_sectors);
> + list_for_each_entry(rdev, &mddev->disks, same_set) {
> + dev_sectors = rdev->sectors;
> + sector_div(dev_sectors, mddev->chunk_sectors);
> + if (dev_sectors != sectors) {
> + printk("error: cannot takeover raid 0 with different dev sizes.\n");
> + return ERR_PTR(-EINVAL);
> + }
> + }
> + return raid5_takeover_raid0(mddev);
> + }
I would rather you just look inside the raid0_private_data to see tha
nr_strip_zones is zero.
Thanks,
NeilBrown
next prev parent reply other threads:[~2010-01-31 23:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-29 14:54 [PATCH 1/3] md:Add support for Raid0->Raid5 takeover Trela, Maciej
2010-01-31 23:58 ` Neil Brown [this message]
2010-02-03 11:59 ` Trela, Maciej
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=20100201105806.62e4dd94@notabene.brown \
--to=neilb@suse.de \
--cc=Maciej.Trela@intel.com \
--cc=dan.j.williams@intel.com \
--cc=ed.ciechanowski@intel.com \
--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).