All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: blk-mq: fix initializing request's start time
@ 2014-01-03 11:29 Ming Lei
  2014-01-03 17:03 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2014-01-03 11:29 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel; +Cc: Ming Lei

blk_rq_init() is called in req's complete handler to initialize
the request, so the members of start_time and start_time_ns might
become inaccurate when it is allocated in future.

The patch initializes the two members in blk_mq_rq_ctx_init() to
fix the problem.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 block/blk-mq.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 0974a26..68734f87 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -188,6 +188,8 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx,
 
 	rq->mq_ctx = ctx;
 	rq->cmd_flags = rw_flags;
+	rq->start_time = jiffies;
+	set_start_time_ns(rq);
 	ctx->rq_dispatched[rw_is_sync(rw_flags)]++;
 }
 
-- 
1.7.9.5


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

* Re: [PATCH] block: blk-mq: fix initializing request's start time
  2014-01-03 11:29 [PATCH] block: blk-mq: fix initializing request's start time Ming Lei
@ 2014-01-03 17:03 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2014-01-03 17:03 UTC (permalink / raw)
  To: Ming Lei, linux-kernel

On 01/03/2014 04:29 AM, Ming Lei wrote:
> blk_rq_init() is called in req's complete handler to initialize
> the request, so the members of start_time and start_time_ns might
> become inaccurate when it is allocated in future.
> 
> The patch initializes the two members in blk_mq_rq_ctx_init() to
> fix the problem.

Thanks, applied!

-- 
Jens Axboe


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

end of thread, other threads:[~2014-01-03 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-03 11:29 [PATCH] block: blk-mq: fix initializing request's start time Ming Lei
2014-01-03 17:03 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.