2022-09-16 11:28:57

by Yu Kuai

[permalink] [raw]
Subject: [PATCH v3 2/5] md/raid10: don't modify 'nr_waitng' in wait_barrier() for the case nowait

From: Yu Kuai <[email protected]>

For the case nowait in wait_barrier(), there is no point to increase
nr_waiting and then decrease it.

Signed-off-by: Yu Kuai <[email protected]>
---
drivers/md/raid10.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 37fd9284054e..df435d693637 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -990,17 +990,17 @@ static bool wait_barrier(struct r10conf *conf, bool nowait)

spin_lock_irq(&conf->resync_lock);
if (conf->barrier) {
- conf->nr_waiting++;
/* Return false when nowait flag is set */
if (nowait) {
ret = false;
} else {
+ conf->nr_waiting++;
raid10_log(conf->mddev, "wait barrier");
wait_event_lock_irq(conf->wait_barrier,
stop_waiting_barrier(conf),
conf->resync_lock);
+ conf->nr_waiting--;
}
- conf->nr_waiting--;
if (!conf->nr_waiting)
wake_up(&conf->wait_barrier);
}
--
2.31.1


2022-09-16 19:15:11

by Logan Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH v3 2/5] md/raid10: don't modify 'nr_waitng' in wait_barrier() for the case nowait



On 2022-09-16 05:34, Yu Kuai wrote:
> From: Yu Kuai <[email protected]>
>
> For the case nowait in wait_barrier(), there is no point to increase
> nr_waiting and then decrease it.
>
> Signed-off-by: Yu Kuai <[email protected]>

Reviewed-by: Logan Gunthorpe <[email protected]>

2022-09-18 11:43:59

by Guoqing Jiang

[permalink] [raw]
Subject: Re: [PATCH v3 2/5] md/raid10: don't modify 'nr_waitng' in wait_barrier() for the case nowait



On 9/16/22 7:34 PM, Yu Kuai wrote:
> From: Yu Kuai <[email protected]>
>
> For the case nowait in wait_barrier(), there is no point to increase
> nr_waiting and then decrease it.
>
> Signed-off-by: Yu Kuai <[email protected]>
> ---
> drivers/md/raid10.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 37fd9284054e..df435d693637 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -990,17 +990,17 @@ static bool wait_barrier(struct r10conf *conf, bool nowait)
>
> spin_lock_irq(&conf->resync_lock);
> if (conf->barrier) {
> - conf->nr_waiting++;
> /* Return false when nowait flag is set */
> if (nowait) {
> ret = false;
> } else {
> + conf->nr_waiting++;
> raid10_log(conf->mddev, "wait barrier");
> wait_event_lock_irq(conf->wait_barrier,
> stop_waiting_barrier(conf),
> conf->resync_lock);
> + conf->nr_waiting--;
> }
> - conf->nr_waiting--;
> if (!conf->nr_waiting)
> wake_up(&conf->wait_barrier);
> }

Acked-by: Guoqing Jiang <[email protected]>

Thanks,
Guoqing