Skip to contentSkip to conversation

block: blk-mq: fix initializing request's start time

PATCH Applied Ming Lei 2 participants 2 messages Jan 3, 2014 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block: blk-mq: fix initializing request's start time

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.

---
 block/blk-mq.c |    2 ++
 1 file changed, 2 insertions(+)
block/blk-mq.c +2 -0
index 0974a26..68734f87 100644
@@ -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)]++;
 }
 
Signature · 1 line
1.7.9.5
maintainer Applied
#1 lore raw
Quoted 6 lines · 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.

Thanks, applied!

Signature · 1 line
Jens Axboe