Skip to contentSkip to conversation

blk-mq: cache rq->q

PATCH In review Shaohua Li 2 participants 2 messages Oct 11, 2013 Block layer

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

PATCH 1/1 blk-mq: cache rq->q

If a tag is freed, the request might be used very soon. There is a short window rq->q is null, so cache it.

---
 block/blk-mq.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-mq.c +2 -1
Index: master/block/blk-mq.c
===================================================================
@@ -250,11 +250,12 @@ static void __blk_mq_free_request(struct
 				  struct blk_mq_ctx *ctx, struct request *rq)
 {
 	const int tag = rq->tag;
+	struct request_queue *q = rq->q;
 
 	blk_mq_rq_init(hctx, rq);
 	blk_mq_put_tag(hctx->tags, tag);
 
-	blk_mq_queue_exit(rq->q);
+	blk_mq_queue_exit(q);
 }
 
 void blk_mq_free_request(struct request *rq)
maintainer
#1 lore raw
Quoted 3 lines · Shaohua Li

If a tag is freed, the request might be used very soon. There is a short window rq->q is null, so cache it.

Thanks, good catch! Applied.

Signature · 1 line
Jens Axboe