public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blk-mq: cache rq->q
@ 2013-10-11  4:11 Shaohua Li
  2013-10-11 14:25 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Shaohua Li @ 2013-10-11  4:11 UTC (permalink / raw)
  To: linux-kernel, axboe


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

Signed-off-by: Shaohua Li <shli@fusionio.com>
---
 block/blk-mq.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: master/block/blk-mq.c
===================================================================
--- master.orig/block/blk-mq.c	2013-10-11 12:07:32.282133638 +0800
+++ master/block/blk-mq.c	2013-10-11 12:07:32.282133638 +0800
@@ -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)

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

* Re: [PATCH] blk-mq: cache rq->q
  2013-10-11  4:11 [PATCH] blk-mq: cache rq->q Shaohua Li
@ 2013-10-11 14:25 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2013-10-11 14:25 UTC (permalink / raw)
  To: Shaohua Li, linux-kernel

On 10/10/2013 10:11 PM, Shaohua Li wrote:
> 
> 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.

-- 
Jens Axboe


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

end of thread, other threads:[~2013-10-11 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11  4:11 [PATCH] blk-mq: cache rq->q Shaohua Li
2013-10-11 14:25 ` Jens Axboe

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