[PATCH v2] md raid1: allow writebehind to work on any leg device set WriteMostly

heinzm@redhat.com posted 1 patch 2 years, 4 months ago
drivers/md/raid1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] md raid1: allow writebehind to work on any leg device set WriteMostly
Posted by heinzm@redhat.com 2 years, 4 months ago
From: Heinz Mauelshagen <heinzm@redhat.com>

This is version 2 replacing my previous patch series as requested by Song Liu.

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: Heinz Mauelshagen <heinzm@redhat.com>
Tested-by: Xiao Ni <xni@redhat.com>
---
 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
Re: [PATCH v2] md raid1: allow writebehind to work on any leg device set WriteMostly
Posted by Song Liu 2 years, 4 months ago
On Mon, Aug 14, 2023 at 8:04 PM <heinzm@redhat.com> wrote:
>
> From: Heinz Mauelshagen <heinzm@redhat.com>
>
> This is version 2 replacing my previous patch series as requested by Song Liu.

For future patches, you can move the line above to ...

>
> 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: Heinz Mauelshagen <heinzm@redhat.com>
> Tested-by: Xiao Ni <xni@redhat.com>
> ---

... here, below an extra "---" so that git-am will remove it automatically.

Other than this, applied to md-next.

Thanks,
Song

> ---
>  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
>