diff mbox series

[RESEND,v2,06/10] block, bfq: remove redundant bfqd->rq_in_driver > 0 check in bfq_add_request

Message ID 20221222191641.1643117-7-shikemeng@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series A few bugfix and cleancode patch for bfq | expand

Commit Message

Kemeng Shi Dec. 22, 2022, 7:16 p.m. UTC
The bfqd->rq_in_driver > 0 check is along with previous
"bfqd->rq_in_driver == 0 ||" check, so no need to re-check
bfqd->rq_in_driver > 0.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 block/bfq-iosched.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jan Kara Jan. 2, 2023, 3:54 p.m. UTC | #1
On Fri 23-12-22 03:16:37, Kemeng Shi wrote:
> The bfqd->rq_in_driver > 0 check is along with previous
> "bfqd->rq_in_driver == 0 ||" check, so no need to re-check
> bfqd->rq_in_driver > 0.
> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

I have nothing against this but OTOH in this complex condition the original
version looks more readable than the new one to me.

								Honza

> ---
>  block/bfq-iosched.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
> index ebcafe3c4c3b..7c91d16dbf6f 100644
> --- a/block/bfq-iosched.c
> +++ b/block/bfq-iosched.c
> @@ -2204,8 +2204,7 @@ static void bfq_add_request(struct request *rq)
>  		 */
>  		if (bfqq == bfqd->in_service_queue &&
>  		    (bfqd->rq_in_driver == 0 ||
> -		     (bfqq->last_serv_time_ns > 0 &&
> -		      bfqd->rqs_injected && bfqd->rq_in_driver > 0)) &&
> +		     (bfqq->last_serv_time_ns > 0 && bfqd->rqs_injected)) &&
>  		    time_is_before_eq_jiffies(bfqq->decrease_time_jif +
>  					      msecs_to_jiffies(10))) {
>  			bfqd->last_empty_occupied_ns = ktime_get_ns();
> -- 
> 2.30.0
>
diff mbox series

Patch

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index ebcafe3c4c3b..7c91d16dbf6f 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -2204,8 +2204,7 @@  static void bfq_add_request(struct request *rq)
 		 */
 		if (bfqq == bfqd->in_service_queue &&
 		    (bfqd->rq_in_driver == 0 ||
-		     (bfqq->last_serv_time_ns > 0 &&
-		      bfqd->rqs_injected && bfqd->rq_in_driver > 0)) &&
+		     (bfqq->last_serv_time_ns > 0 && bfqd->rqs_injected)) &&
 		    time_is_before_eq_jiffies(bfqq->decrease_time_jif +
 					      msecs_to_jiffies(10))) {
 			bfqd->last_empty_occupied_ns = ktime_get_ns();