All of lore.kernel.org
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: NeilBrown <neilb@suse.de>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: Re: [PATCH 1/4] md/raid5: Reduce one write-operation when handle badsector
Date: Mon, 4 Mar 2013 10:37:09 +0800	[thread overview]
Message-ID: <2013030410370206658210@gmail.com> (raw)
In-Reply-To: 20130304132533.571e8070@notabene.brown

>On Mon, 4 Mar 2013 09:52:57 +0800 majianpeng <majianpeng@gmail.com> wrote:
>
>> >On Thu, 28 Feb 2013 15:51:01 +0800 majianpeng <majianpeng@gmail.com> wrote:
>> >
>> >> For badsector,it took two steps:rewrite and reread.So for
>> >> write-operation,it make no sense to rewrite after write-operation.
>> >
>> >Please please please please please try to explain yourself better.
>> >
>> Sorry for that. 
>> >This patch doesn't make any sense.  The write succeeded.  We set the MadeGood
>> >flag so that later code will remove the block from the bad-block list.
>> >There will be no re-read or re-write.
>> >
>> For a striep which contain badsector is doing write-operation.
>> In analyse_stripe, it check badsector and set R5_ReadError.
>>  write--->MadeGood->clear badblock log. But it can't clear R5_ReadError flag.
>> So it will exec those code in func handle_stripe:
>
>After you wrote that, did you read it again to see if it makes any sense?  It
>does but only just.
>
>I'd rather have a good explanation in the code so it is clear what is going
>on.
>
>diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
>index 3e0ec16..277d9c2 100644
>--- a/drivers/md/raid5.c
>+++ b/drivers/md/raid5.c
>@@ -1911,8 +1911,15 @@ static void raid5_end_write_request(struct bio *bi, int error)
> 					&rdev->mddev->recovery);
> 		} else if (is_badblock(rdev, sh->sector,
> 				       STRIPE_SECTORS,
>-				       &first_bad, &bad_sectors))
>+				       &first_bad, &bad_sectors)) {
> 			set_bit(R5_MadeGood, &sh->dev[i].flags);
>+			if (test_bit(R5_ReadError, &sh->dev[i].flags))
Why do it test R5_ReadError?
Even if  it didn't set R5_ReadError, it also do in analyse_stripe.

Thanks!
Jianpeng Ma
>+				/* That was a successful write so make
>+				 * sure it looks like we already did
>+				 * a re-write.
>+				 */
>+				set_bit(R5_ReWrite, &sh->dev[i].flags);
>+		}
> 	}
> 	rdev_dec_pending(rdev, conf->mddev);
> 
>Thanks,
>NeilBrown
>

      reply	other threads:[~2013-03-04  2:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-28  7:51 [PATCH 1/4] md/raid5: Reduce one write-operation when handle badsector majianpeng
2013-03-04  1:43 ` NeilBrown
2013-03-04  1:52   ` majianpeng
2013-03-04  2:25     ` NeilBrown
2013-03-04  2:37       ` majianpeng [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=2013030410370206658210@gmail.com \
    --to=majianpeng@gmail.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.