From: NeilBrown <neilb@suse.com>
To: Shaohua Li <shli@kernel.org>
Cc: linux-raid@vger.kernel.org, hch@lst.de
Subject: Re: [md PATCH 10/15] md/raid1: stop using bi_phys_segment
Date: Thu, 16 Mar 2017 13:49:57 +1100 [thread overview]
Message-ID: <8737eedjfu.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20170316001355.lyhq7lkyvndsocwo@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2836 bytes --]
On Wed, Mar 15 2017, Shaohua Li wrote:
> On Wed, Mar 15, 2017 at 02:05:14PM +1100, Neil Brown wrote:
>> Change to use bio->__bi_remaining to count number of r1bio attached
>> to a bio.
>> See precious raid10 patch for more details.
>>
>> Like the raid10.c patch, this fixes a bug as nr_queued and nr_pending
>> used to measure different things, but were being compared.
>>
>> This patch fixes another bug in that nr_pending previously did not
>> could write-behind requests, so behind writes could continue while
>> resync was happening. How that nr_pending counts all r1_bio,
>> the resync cannot commence until the behind writes have completed.
>>
>> Signed-off-by: NeilBrown <neilb@suse.com>
>> ---
>> drivers/md/raid1.c | 87 +++++++++++++---------------------------------------
>> 1 file changed, 22 insertions(+), 65 deletions(-)
>>
>> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
>> index 7e509a894f15..e566407b196f 100644
>> --- a/drivers/md/raid1.c
>> +++ b/drivers/md/raid1.c
>> @@ -246,35 +246,18 @@ static void reschedule_retry(struct r1bio *r1_bio)
>> static void call_bio_endio(struct r1bio *r1_bio)
>> {
>> struct bio *bio = r1_bio->master_bio;
>> - int done;
>> struct r1conf *conf = r1_bio->mddev->private;
>> sector_t bi_sector = bio->bi_iter.bi_sector;
>>
>> - if (bio->bi_phys_segments) {
>> - unsigned long flags;
>> - spin_lock_irqsave(&conf->device_lock, flags);
>> - bio->bi_phys_segments--;
>> - done = (bio->bi_phys_segments == 0);
>> - spin_unlock_irqrestore(&conf->device_lock, flags);
>> - /*
>> - * make_request() might be waiting for
>> - * bi_phys_segments to decrease
>> - */
>> - wake_up(&conf->wait_barrier);
>> - } else
>> - done = 1;
>> -
>> if (!test_bit(R1BIO_Uptodate, &r1_bio->state))
>> bio->bi_error = -EIO;
>>
>> - if (done) {
>> - bio_endio(bio);
>> - /*
>> - * Wake up any possible resync thread that waits for the device
>> - * to go idle.
>> - */
>> - allow_barrier(conf, bi_sector);
>> - }
>> + bio_endio(bio);
>> + /*
>> + * Wake up any possible resync thread that waits for the device
>> + * to go idle.
>> + */
>> + allow_barrier(conf, bi_sector);
>
> I think this one should be r1_bio->sector instead of master_bio->sector,
> because multiple r1_bio could be attached to a master_bio. Maybe not change
> anything, because both sector should be in the same barrier unit, but we'd
> better to be consistent.
Yes, I agree. Both that it won't make a practical difference and that
it should be changed.
I just noticed another little problem with this patch.
The chunk in handle_read_error() should have added inc_pending()
near where it added bio_inc_remaining().
Shall I just resend the individual patch (and the raid5 one?).
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-03-16 2:49 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-15 3:05 [md PATCH 00/15 v2] remove all abuse of bi_phys_segments NeilBrown
2017-03-15 3:05 ` [md PATCH 04/15] block: trace completion of all bios NeilBrown
2017-03-15 3:05 ` [md PATCH 01/15] md/raid5: use md_write_start to count stripes, not bios NeilBrown
2017-03-15 3:05 ` [md PATCH 03/15] md/raid5: call bio_endio() directly rather than queueing for later NeilBrown
2017-03-15 3:05 ` [md PATCH 02/15] md/raid5: simplfy delaying of writes while metadata is updated NeilBrown
2017-03-15 23:03 ` Shaohua Li
2017-03-16 2:45 ` NeilBrown
2017-03-22 1:40 ` Fix bug in " NeilBrown
2017-03-22 2:29 ` REALLY " NeilBrown
2017-03-22 2:35 ` NeilBrown
2017-03-23 2:22 ` Shaohua Li
2017-03-15 3:05 ` [md PATCH 09/15] md/raid10: stop using bi_phys_segments NeilBrown
2017-03-15 3:05 ` [md PATCH 08/15] md/raid1, raid10: move rXbio accounting closer to allocation NeilBrown
2017-03-15 3:05 ` [md PATCH 06/15] md/raid5: remove over-loading of ->bi_phys_segments NeilBrown
2017-03-15 3:05 ` [md PATCH 07/15] Revert "md/raid5: limit request size according to implementation limits" NeilBrown
2017-03-15 3:05 ` [md PATCH 05/15] md/raid5: use bio_inc_remaining() instead of repurposing bi_phys_segments as a counter NeilBrown
2017-03-15 3:05 ` [md PATCH 12/15] md: factor out set_in_sync() NeilBrown
2017-03-15 3:05 ` [md PATCH 13/15] md: close a race with setting mddev->in_sync NeilBrown
2017-03-15 3:05 ` [md PATCH 10/15] md/raid1: stop using bi_phys_segment NeilBrown
2017-03-16 0:13 ` Shaohua Li
2017-03-16 2:49 ` NeilBrown [this message]
2017-03-16 3:36 ` Shaohua Li
2017-03-22 1:41 ` Fix bugs in " NeilBrown
2017-03-15 3:05 ` [md PATCH 11/15] md/raid5: don't test ->writes_pending in raid5_remove_disk NeilBrown
2017-03-15 3:05 ` [md PATCH 15/15] MD: use per-cpu counter for writes_pending NeilBrown
2017-03-16 1:05 ` Shaohua Li
2017-03-16 2:57 ` NeilBrown
2017-03-22 1:55 ` Improvement for " NeilBrown
2017-03-22 2:34 ` IMPROVEMENT for " NeilBrown
2017-03-15 3:05 ` [md PATCH 14/15] percpu-refcount: support synchronous switch to atomic mode NeilBrown
2017-03-16 1:12 ` [md PATCH 00/15 v2] remove all abuse of bi_phys_segments Shaohua Li
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=8737eedjfu.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=hch@lst.de \
--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;
as well as URLs for NNTP newsgroup(s).