2023-08-10 12:33:15

by Heinz Mauelshagen

[permalink] [raw]
Subject: [PATCH 1/3] md raid1: allow writebehind to work on any leg device set WriteMostly

From: heinzm <[email protected]>

As the WriteMostly flag can be set on any component device of a RAID1 array,
remove the constraint that it only works if set on the first one.

Signed-off-by: heinzm <[email protected]>
---
drivers/md/raid1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index dd25832eb045..913cd46b786b 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1519,7 +1519,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
* allocate memory, or a reader on WriteMostly
* is waiting for behind writes to flush */
if (bitmap &&
- test_bit(WriteMostly, &rdev->flags) &&
+ write_behind &&
(atomic_read(&bitmap->behind_writes)
< mddev->bitmap_info.max_write_behind) &&
!waitqueue_active(&bitmap->behind_wait)) {
--
2.41.0



2023-08-11 02:20:24

by Yu Kuai

[permalink] [raw]
Subject: Re: [PATCH 1/3] md raid1: allow writebehind to work on any leg device set WriteMostly

Hi,

?? 2023/08/10 20:11, [email protected] ะด??:
> From: heinzm <[email protected]>
>
> As the WriteMostly flag can be set on any component device of a RAID1 array,
> remove the constraint that it only works if set on the first one.
>
> Signed-off-by: heinzm <[email protected]>
> ---
> drivers/md/raid1.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index dd25832eb045..913cd46b786b 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -1519,7 +1519,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
> * allocate memory, or a reader on WriteMostly
> * is waiting for behind writes to flush */
> if (bitmap &&
> - test_bit(WriteMostly, &rdev->flags) &&
> + write_behind &&

No need for a new line now.

Reviewed-by: Yu Kuai <[email protected]>

Thanks
> (atomic_read(&bitmap->behind_writes)
> < mddev->bitmap_info.max_write_behind) &&
> !waitqueue_active(&bitmap->behind_wait)) {
>