From: NeilBrown <neilb@suse.com>
To: Coly Li <colyli@suse.de>, Shaohua Li <shli@kernel.org>
Cc: Avi Kivity <avi@scylladb.com>,
linux-raid@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: raid0 vs. mkfs
Date: Mon, 12 Dec 2016 14:17:58 +1100 [thread overview]
Message-ID: <87y3zlzvh5.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <14867138-b0ea-fb58-dae6-70f30a3ddcc8@suse.de>
[-- Attachment #1: Type: text/plain, Size: 3524 bytes --]
On Fri, Dec 09 2016, Coly Li wrote:
> On 2016/12/9 上午3:19, Shaohua Li wrote:
>> On Fri, Dec 09, 2016 at 12:44:57AM +0800, Coly Li wrote:
>>> On 2016/12/8 上午12:59, Shaohua Li wrote:
>>>> On Wed, Dec 07, 2016 at 07:50:33PM +0800, Coly Li wrote:
>>> [snip]
>>>> Thanks for doing this, Coly! For raid0, this totally makes sense. The raid0
>>>> zones make things a little complicated though. I just had a brief look of your
>>>> proposed patch, which looks really complicated. I'd suggest something like
>>>> this:
>>>> 1. split the bio according to zone boundary.
>>>> 2. handle the splitted bio. since the bio is within zone range, calculating
>>>> the start and end sector for each rdev should be easy.
>>>>
>>>
>>> Hi Shaohua,
>>>
>>> Thanks for your suggestion! I try to modify the code by your suggestion,
>>> it is even more hard to make the code that way ...
>>>
>>> Because even split bios for each zone, all the corner cases still exist
>>> and should be taken care in every zoon. The code will be more complicated.
>>
>> Not sure why it makes the code more complicated. Probably I'm wrong, but Just
>> want to make sure we are in the same page: split the bio according to zone
>> boundary, then handle the splitted bio separately. Calculating end/start point
>> of each rdev for the new bio within a zone should be simple. we then clone a
>> bio for each rdev and dispatch. So for example:
>> Disk 0: D0 D2 D4 D6 D7
>> Disk 1: D1 D3 D5
>> zone 0 is from D0 - D5, zone 1 is from D6 - D7
>> If bio is from D1 to D7, we split it to 2 bios, one is D1 - D5, the other D6 - D7.
>> For D1 - D5, we dispatch 2 bios. D1 - D5 for disk 1, D2 - D4 for disk 0
>> For D6 - D7, we just dispatch to disk 0.
>> What kind of corner case makes this more complicated?
>>
>
> Let me explain the corner cases.
>
> When upper layer code issues a DISCARD bio, the bio->bi_iter.bi_sector
> may not be chunk size aligned, and bio->bi_iter.bi_size may not be
> (chunk_sects*nb_dev) sectors aligned. In raid0, we can't simply round
> up/down them into chunk size aligned number, otherwise data
> lost/corruption will happen.
>
> Therefore for each DISCARD bio that raid0_make_request() receive, the
> beginning and ending parts of this bio should be treat very carefully.
> All the corner cases *come from here*, they are not about number of
> zones or rdevs, it is about whether bio->bi_iter.bi_sector and
> bio->bi_iter.bi_size are chunk size aligned or not.
>
> - beginning of the bio
> If bio->bi_iter.bi_sector is not chunk size aligned, current raid0
> code will split the beginning part into split bio which only contains
> sectors from bio->bi_iter.sector to next chunk size aligned offset, and
> issue this bio by generic_make_request(). But in
> discard_large_discard_bio() we can't issue the split bio now, we have to
> record lenth of this split bio into a per-device structure, and issue a
Why?
Why cannot you just split of the start of the bio and chain it with the
rest of the bio?
If the bio doesn't start at the beginning of a stripe, just split of the
first (partial) chunk exactly was we currently do.
If it does start at the beginning of a stripe, then split off a whole
number of stripes and allocate one bio for each device. Chain those to
the original bio together with any remainder (which isn't a whole
stripe).
I think that if you make use of bio_split() and bio_chain() properly,
the code will be much simpler.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2016-12-12 3:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <56c83c4e-d451-07e5-88e2-40b085d8681c@scylladb.com>
[not found] ` <87oa108a1x.fsf@notabene.neil.brown.name>
[not found] ` <286a5fc1-eda3-0421-a88e-b03c09403259@scylladb.com>
[not found] ` <87inr880au.fsf@notabene.neil.brown.name>
[not found] ` <df73ebc4-9b78-09b5-022b-089c30dea17c@scylladb.com>
[not found] ` <87d1he7zv9.fsf@notabene.neil.brown.name>
[not found] ` <33bb250a-4dfd-0acc-9958-30fdac10918c@scylladb.com>
2016-12-07 11:50 ` raid0 vs. mkfs Coly Li
2016-12-07 12:03 ` Coly Li
2016-12-07 16:59 ` Shaohua Li
2016-12-08 16:44 ` Coly Li
2016-12-08 19:19 ` Shaohua Li
2016-12-09 7:34 ` Coly Li
2016-12-12 3:17 ` NeilBrown [this message]
2017-06-29 15:15 ` Avi Kivity
2017-06-29 15:31 ` Coly Li
2017-06-29 15:36 ` Avi Kivity
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=87y3zlzvh5.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=avi@scylladb.com \
--cc=colyli@suse.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=shli@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