2023-01-03 01:57:57

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH v3 7/8] block, bfq: remove unnecessary goto tag in bfq_dispatch_rq_from_bfqq

We jump to tag only for returning current rq. Return directly to
remove this tag.

Signed-off-by: Kemeng Shi <[email protected]>
---
block/bfq-iosched.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 9ff424c78e9b..a11be312ac77 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4966,7 +4966,7 @@ static struct request *bfq_dispatch_rq_from_bfqq(struct bfq_data *bfqd,
bfq_dispatch_remove(bfqd->queue, rq);

if (bfqq != bfqd->in_service_queue)
- goto return_rq;
+ return rq;

/*
* If weight raising has to terminate for bfqq, then next
@@ -4986,12 +4986,9 @@ static struct request *bfq_dispatch_rq_from_bfqq(struct bfq_data *bfqd,
* belongs to CLASS_IDLE and other queues are waiting for
* service.
*/
- if (!(bfq_tot_busy_queues(bfqd) > 1 && bfq_class_idle(bfqq)))
- goto return_rq;
+ if (bfq_tot_busy_queues(bfqd) > 1 && bfq_class_idle(bfqq))
+ bfq_bfqq_expire(bfqd, bfqq, false, BFQQE_BUDGET_EXHAUSTED);

- bfq_bfqq_expire(bfqd, bfqq, false, BFQQE_BUDGET_EXHAUSTED);
-
-return_rq:
return rq;
}

--
2.30.0


2023-01-03 02:53:56

by Damien Le Moal

[permalink] [raw]
Subject: Re: [PATCH v3 7/8] block, bfq: remove unnecessary goto tag in bfq_dispatch_rq_from_bfqq

On 1/3/23 18:53, Kemeng Shi wrote:
> We jump to tag only for returning current rq. Return directly to
> remove this tag.
>
> Signed-off-by: Kemeng Shi <[email protected]>
> ---
> block/bfq-iosched.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
> index 9ff424c78e9b..a11be312ac77 100644
> --- a/block/bfq-iosched.c
> +++ b/block/bfq-iosched.c
> @@ -4966,7 +4966,7 @@ static struct request *bfq_dispatch_rq_from_bfqq(struct bfq_data *bfqd,
> bfq_dispatch_remove(bfqd->queue, rq);
>
> if (bfqq != bfqd->in_service_queue)
> - goto return_rq;
> + return rq;
>
> /*
> * If weight raising has to terminate for bfqq, then next
> @@ -4986,12 +4986,9 @@ static struct request *bfq_dispatch_rq_from_bfqq(struct bfq_data *bfqd,
> * belongs to CLASS_IDLE and other queues are waiting for
> * service.
> */
> - if (!(bfq_tot_busy_queues(bfqd) > 1 && bfq_class_idle(bfqq)))
> - goto return_rq;
> + if (bfq_tot_busy_queues(bfqd) > 1 && bfq_class_idle(bfqq))
> + bfq_bfqq_expire(bfqd, bfqq, false, BFQQE_BUDGET_EXHAUSTED);
>
> - bfq_bfqq_expire(bfqd, bfqq, false, BFQQE_BUDGET_EXHAUSTED);
> -
> -return_rq:
> return rq;
> }
>

Looks OK to me.

Reviewed-by: Damien Le Moal <[email protected]>

--
Damien Le Moal
Western Digital Research

2023-01-03 09:54:26

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH v3 7/8] block, bfq: remove unnecessary goto tag in bfq_dispatch_rq_from_bfqq

On Tue 03-01-23 17:53:02, Kemeng Shi wrote:
> We jump to tag only for returning current rq. Return directly to
> remove this tag.
>
> Signed-off-by: Kemeng Shi <[email protected]>

Looks good to me. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> block/bfq-iosched.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
> index 9ff424c78e9b..a11be312ac77 100644
> --- a/block/bfq-iosched.c
> +++ b/block/bfq-iosched.c
> @@ -4966,7 +4966,7 @@ static struct request *bfq_dispatch_rq_from_bfqq(struct bfq_data *bfqd,
> bfq_dispatch_remove(bfqd->queue, rq);
>
> if (bfqq != bfqd->in_service_queue)
> - goto return_rq;
> + return rq;
>
> /*
> * If weight raising has to terminate for bfqq, then next
> @@ -4986,12 +4986,9 @@ static struct request *bfq_dispatch_rq_from_bfqq(struct bfq_data *bfqd,
> * belongs to CLASS_IDLE and other queues are waiting for
> * service.
> */
> - if (!(bfq_tot_busy_queues(bfqd) > 1 && bfq_class_idle(bfqq)))
> - goto return_rq;
> + if (bfq_tot_busy_queues(bfqd) > 1 && bfq_class_idle(bfqq))
> + bfq_bfqq_expire(bfqd, bfqq, false, BFQQE_BUDGET_EXHAUSTED);
>
> - bfq_bfqq_expire(bfqd, bfqq, false, BFQQE_BUDGET_EXHAUSTED);
> -
> -return_rq:
> return rq;
> }
>
> --
> 2.30.0
>
--
Jan Kara <[email protected]>
SUSE Labs, CR