* [PATCH] md/raid456:Remove the judgement atomic_read(&rdev->read_errors).
@ 2012-05-23 12:38 majianpeng
2012-05-23 23:40 ` NeilBrown
0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2012-05-23 12:38 UTC (permalink / raw)
To: Neil Brown; +Cc: linux-raid
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.
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;
--
1.7.5.4
--------------
majianpeng
2012-05-23
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] md/raid456:Remove the judgement atomic_read(&rdev->read_errors).
2012-05-23 12:38 [PATCH] md/raid456:Remove the judgement atomic_read(&rdev->read_errors) majianpeng
@ 2012-05-23 23:40 ` NeilBrown
0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2012-05-23 23:40 UTC (permalink / raw)
To: majianpeng; +Cc: linux-raid
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-23 23:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-23 12:38 [PATCH] md/raid456:Remove the judgement atomic_read(&rdev->read_errors) majianpeng
2012-05-23 23:40 ` NeilBrown
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).