From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: NeilBrown <neilb@suse.de>
Cc: dledford@redhat.com, linux-raid@vger.kernel.org
Subject: Re: [PATCH 1/1] Avoid OOPS when reshaping raid1 to raid0
Date: Mon, 26 Mar 2012 10:29:43 +0200 [thread overview]
Message-ID: <4F7028F7.5080401@redhat.com> (raw)
In-Reply-To: <20120326092905.27147102@notabene.brown>
On 03/26/12 00:29, NeilBrown wrote:
> On Thu, 22 Mar 2012 17:15:53 +0100 Jes.Sorensen@redhat.com wrote:
>
>> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>>
>> raid1 arrays do not have the notion of chunk size. Set the existing
>> chunk size of the new raid0 to the same as the proposed new chunk size
>> to avoid a divide by zero OOPS when aligning the size of the new array
>> to that of the chunk size.
>
> This oops happens in create_strip_zones at
>
> sector_div(sectors, mddev->chunk_sectors);
>
> correct?
Correct
>> mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */
>> + mddev->chunk_sectors = 128; /*
>> + * a raid1 one doesn't have the
>> + * notion of chunk size, so set
>> + * existing chunk_sector to match the
>> + * new size to avoid divide by zero
>> + * when aligning the size of the new
>> + * raid0 to the existing chunk size.
>> + */
>
> But what if the RAID1 is not a multiple of 64K ? Then you will lose
> data.
Good point - I wasn't sure what the actual sizes would be in practice.
> We probably want the same thing we have in RAID5:
>
>
>
> 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);
>
>
> ??
>
> Do you want to make a patch, or shall I?
I have brewed up a patch based on this. I used PAGE_SIZE instead of
STRIPE_SIZE for the limit since we don't have stripes in raid0. I'll
post it in a minute.
Cheers,
Jes
prev parent reply other threads:[~2012-03-26 8:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-22 16:15 [PATCH 0/1] Avoid OOPS when reshaping raid1 to raid0 Jes.Sorensen
2012-03-22 16:15 ` [PATCH 1/1] " Jes.Sorensen
2012-03-22 16:19 ` Doug Ledford
2012-03-25 22:29 ` NeilBrown
2012-03-26 8:29 ` Jes Sorensen [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=4F7028F7.5080401@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=dledford@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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.