From: NeilBrown <neilb@suse.de>
To: majianpeng <majianpeng@gmail.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH] md/raid456:Remove the judgement atomic_read(&rdev->read_errors).
Date: Thu, 24 May 2012 09:40:22 +1000 [thread overview]
Message-ID: <20120524094022.5a951c91@notabene.brown> (raw)
In-Reply-To: <201205232038121562929@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]
On Wed, 23 May 2012 20:38:16 +0800 "majianpeng" <majianpeng@gmail.com> wrote:
> It isn't necessary to judge.Because the atomic_read and atomic_set is excuce same cpu. So
> read_errors is zero or not, directly set it zero.
'read' imposes less bus contention than 'write'. And read_errors will most
often be 0. So if we can avoid lots of unnecessary writes we should.
i.e. code is correct as it is.
Thanks,
NeilBrown
> Signed-off-by: majianpeng <majianpeng@gmail.com>
> ---
> drivers/md/raid5.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index f351422..1fe2def 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -1690,8 +1690,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
> clear_bit(R5_ReadError, &sh->dev[i].flags);
> clear_bit(R5_ReWrite, &sh->dev[i].flags);
> }
> - if (atomic_read(&rdev->read_errors))
> - atomic_set(&rdev->read_errors, 0);
> + atomic_set(&rdev->read_errors, 0);
> } else {
> const char *bdn = bdevname(rdev->bdev, b);
> int retry = 0;
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2012-05-23 23:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-23 12:38 [PATCH] md/raid456:Remove the judgement atomic_read(&rdev->read_errors) majianpeng
2012-05-23 23:40 ` NeilBrown [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=20120524094022.5a951c91@notabene.brown \
--to=neilb@suse.de \
--cc=linux-raid@vger.kernel.org \
--cc=majianpeng@gmail.com \
/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.