block: simplify blk_mq_finish_request()
PATCH 1/1 block: simplify blk_mq_finish_request()
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.
--- block/blk-mq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
block/blk-mq.c +1 -3
@@ -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
Signature · 1 line
2.53.0
Jens Axboe
maintainerQuoted 16 lines · Damien Le Moal
Remove the local q variable as it is not necessary. This also removes a useless pointer dereference when
RQF_USE_SCHEDis not set for a request.Signed-off-by Damien Le Moal <[email protected]>--- block/blk-mq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)block/blk-mq.c +0
-0@@ -781,12 +781,10 @@ EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx);static void blk_mq_finish_request (struct request *rq) {
block/blk-mq.c EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx); · line 790
Quoted 10 lines
block/blk-mq.c +1
-3-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...
Signature · 1 line
Jens Axboe
Quoted 21 lines · Jens Axboe
Quoted 20 lines · Damien Le Moal
Remove the local q variable as it is not necessary. This also removes a useless pointer dereference when
RQF_USE_SCHEDis not set for a request.Signed-off-by Damien Le Moal <[email protected]>--- block/blk-mq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)block/blk-mq.c +0
-2@@ -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);
Quoted 8 lines
block/blk-mq.c EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx); · line 790
Quoted 6 lines
block/blk-mq.c +1
-1if (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.
Signature · 2 lines
Damien Le Moal Western Digital Research