public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: simplify blk_mq_finish_request()
@ 2026-02-24 21:58 Damien Le Moal
  2026-02-24 22:16 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Damien Le Moal @ 2026-02-24 21:58 UTC (permalink / raw)
  To: Jens Axboe, linux-block

Remove the local q variable as it is not necessary. This also removes a
useless pointer dereference when RQF_USE_SCHED is not set for a request.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 block/blk-mq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9af8c3dec3f6..55a255750ad1 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -781,12 +781,10 @@ EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx);
 
 static void blk_mq_finish_request(struct request *rq)
 {
-	struct request_queue *q = rq->q;
-
 	blk_zone_finish_request(rq);
 
 	if (rq->rq_flags & RQF_USE_SCHED) {
-		q->elevator->type->ops.finish_request(rq);
+		rq->q->elevator->type->ops.finish_request(rq);
 		/*
 		 * For postflush request that may need to be
 		 * completed twice, we should clear this flag
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: simplify blk_mq_finish_request()
  2026-02-24 21:58 [PATCH] block: simplify blk_mq_finish_request() Damien Le Moal
@ 2026-02-24 22:16 ` Jens Axboe
  2026-02-24 22:30   ` Damien Le Moal
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2026-02-24 22:16 UTC (permalink / raw)
  To: Damien Le Moal, linux-block

On 2/24/26 2:58 PM, Damien Le Moal wrote:
> Remove the local q variable as it is not necessary. This also removes a
> useless pointer dereference when RQF_USE_SCHED is not set for a request.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  block/blk-mq.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 9af8c3dec3f6..55a255750ad1 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -781,12 +781,10 @@ EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx);
>  
>  static void blk_mq_finish_request(struct request *rq)
>  {
> -	struct request_queue *q = rq->q;
> -
>  	blk_zone_finish_request(rq);
>  
>  	if (rq->rq_flags & RQF_USE_SCHED) {
> -		q->elevator->type->ops.finish_request(rq);
> +		rq->q->elevator->type->ops.finish_request(rq);
>  		/*
>  		 * For postflush request that may need to be
>  		 * completed twice, we should clear this flag

This will compile to the same code...

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: simplify blk_mq_finish_request()
  2026-02-24 22:16 ` Jens Axboe
@ 2026-02-24 22:30   ` Damien Le Moal
  0 siblings, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2026-02-24 22:30 UTC (permalink / raw)
  To: Jens Axboe, linux-block

On 2/25/26 07:16, Jens Axboe wrote:
> On 2/24/26 2:58 PM, Damien Le Moal wrote:
>> Remove the local q variable as it is not necessary. This also removes a
>> useless pointer dereference when RQF_USE_SCHED is not set for a request.
>>
>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>> ---
>>  block/blk-mq.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>> index 9af8c3dec3f6..55a255750ad1 100644
>> --- a/block/blk-mq.c
>> +++ b/block/blk-mq.c
>> @@ -781,12 +781,10 @@ EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx);
>>  
>>  static void blk_mq_finish_request(struct request *rq)
>>  {
>> -	struct request_queue *q = rq->q;
>> -
>>  	blk_zone_finish_request(rq);
>>  
>>  	if (rq->rq_flags & RQF_USE_SCHED) {
>> -		q->elevator->type->ops.finish_request(rq);
>> +		rq->q->elevator->type->ops.finish_request(rq);
>>  		/*
>>  		 * For postflush request that may need to be
>>  		 * completed twice, we should clear this flag
> 
> This will compile to the same code...

OK. I had not check the compiled code. Sorry for the noise.


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-24 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 21:58 [PATCH] block: simplify blk_mq_finish_request() Damien Le Moal
2026-02-24 22:16 ` Jens Axboe
2026-02-24 22:30   ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox