2023-06-23 09:44:47

by Li Nan

[permalink] [raw]
Subject: [PATCH 0/3] md/raid10: optimize and fix read error

From: Li Nan <[email protected]>

This patch series optimizes and fixes fix_read_error().

Li Nan (3):
md/raid10: optimize fix_read_error
md: remove redundant check in fix_read_error()
md/raid10: handle replacement devices in fix_read_error

drivers/md/raid1.c | 2 +-
drivers/md/raid10.c | 50 +++++++++++++++++++++++----------------------
2 files changed, 27 insertions(+), 25 deletions(-)

--
2.39.2



2023-06-23 09:45:39

by Li Nan

[permalink] [raw]
Subject: [PATCH 2/3] md: remove redundant check in fix_read_error()

From: Li Nan <[email protected]>

In fix_read_error(), 'success' will be checked immediately after assigning
it, if it is set to 1 then the loop will break. Checking it again in
condition of loop is redundant. Clean it up.

Signed-off-by: Li Nan <[email protected]>
---
drivers/md/raid1.c | 2 +-
drivers/md/raid10.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 3570da63969b..0391c2d0c109 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2318,7 +2318,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
d++;
if (d == conf->raid_disks * 2)
d = 0;
- } while (!success && d != read_disk);
+ } while (d != read_disk);

if (!success) {
/* Cannot read from anywhere - mark it bad */
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 94ae294c8a3c..a36e53fce21f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2790,7 +2790,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
sl++;
if (sl == conf->copies)
sl = 0;
- } while (!success && sl != slot);
+ } while (sl != slot);
rcu_read_unlock();

if (!success) {
--
2.39.2


2023-06-23 09:57:12

by Paul Menzel

[permalink] [raw]
Subject: Re: [PATCH 0/3] md/raid10: optimize and fix read error

Dear Li,


Thank you for your patches.

Am 23.06.23 um 19:32 schrieb [email protected]:
> From: Li Nan <[email protected]>

Just a note, that the date/timestamps of your patches are from the
future. (Yu’s patches had the same problem.) Could you please make sure
to set up the system time correctly.

Received: from huaweicloud.com (unknown [10.175.104.67])
by APP4 (Coremail) with SMTP id
gCh0CgCXaK8TZ5VkaZ1hMQ--.14505S4;
Fri, 23 Jun 2023 17:34:11 +0800 (CST)
[…]
Date: Sat, 24 Jun 2023 01:32:33 +0800

[…]


Kind regards,

Paul

2023-06-25 02:12:15

by Li Nan

[permalink] [raw]
Subject: Re: [PATCH 0/3] md/raid10: optimize and fix read error



在 2023/6/23 17:52, Paul Menzel 写道:
> Dear Li,
>
>
> Thank you for your patches.
>
> Am 23.06.23 um 19:32 schrieb [email protected]:
>> From: Li Nan <[email protected]>
>
> Just a note, that the date/timestamps of your patches are from the
> future. (Yu’s patches had the same problem.) Could you please make sure
> to set up the system time correctly.

System time is correct now. Thanks for your reminding :)

>
>     Received: from huaweicloud.com (unknown [10.175.104.67])
>             by APP4 (Coremail) with SMTP id
> gCh0CgCXaK8TZ5VkaZ1hMQ--.14505S4;
>             Fri, 23 Jun 2023 17:34:11 +0800 (CST)
>     […]
>     Date:   Sat, 24 Jun 2023 01:32:33 +0800
>
> […]
>
>
> Kind regards,
>
> Paul

--
Thanks,
Nan


2023-06-26 02:37:26

by Yu Kuai

[permalink] [raw]
Subject: Re: [PATCH 2/3] md: remove redundant check in fix_read_error()

?? 2023/06/24 1:32, [email protected] д??:
> From: Li Nan <[email protected]>
>
> In fix_read_error(), 'success' will be checked immediately after assigning
> it, if it is set to 1 then the loop will break. Checking it again in
> condition of loop is redundant. Clean it up.

LGTM
Reviewed-by: Yu Kuai <[email protected]>
>
> Signed-off-by: Li Nan <[email protected]>
> ---
> drivers/md/raid1.c | 2 +-
> drivers/md/raid10.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> :
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 3570da63969b..0391c2d0c109 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -2318,7 +2318,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
> d++;
> if (d == conf->raid_disks * 2)
> d = 0;
> - } while (!success && d != read_disk);
> + } while (d != read_disk);
>
> if (!success) {
> /* Cannot read from anywhere - mark it bad */
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 94ae294c8a3c..a36e53fce21f 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -2790,7 +2790,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
> sl++;
> if (sl == conf->copies)
> sl = 0;
> - } while (!success && sl != slot);
> + } while (sl != slot);
> rcu_read_unlock();
>
> if (!success) {
>


2023-07-07 08:35:58

by Song Liu

[permalink] [raw]
Subject: Re: [PATCH 0/3] md/raid10: optimize and fix read error

On Fri, Jun 23, 2023 at 5:34 PM <[email protected]> wrote:
>
> From: Li Nan <[email protected]>
>
> This patch series optimizes and fixes fix_read_error().
>
> Li Nan (3):
> md/raid10: optimize fix_read_error
> md: remove redundant check in fix_read_error()

Applied 1/3 and 2/3 to md-next. Thanks!

Song


> md/raid10: handle replacement devices in fix_read_error
>
> drivers/md/raid1.c | 2 +-
> drivers/md/raid10.c | 50 +++++++++++++++++++++++----------------------
> 2 files changed, 27 insertions(+), 25 deletions(-)
>
> --
> 2.39.2
>