@@ -537,11 +537,6 @@ inline void __blk_mq_end_request(struct request *rq, blk_status_t error)
if (blk_mq_need_time_stamp(rq))
now = ktime_get_ns();
- if (rq->rq_flags & RQF_STATS) {
- blk_mq_poll_stats_start(rq->q);
- blk_stat_add(rq, now);
- }
-
if (rq->internal_tag != -1)
blk_mq_sched_completed_request(rq, now);
@@ -580,6 +575,11 @@ static void __blk_mq_complete_request(struct request *rq)
int cpu;
WRITE_ONCE(rq->state, MQ_RQ_COMPLETE);
+
+ if (rq->rq_flags & RQF_STATS) {
+ blk_mq_poll_stats_start(rq->q);
+ blk_stat_add(rq, ktime_get_ns());
+ }
/*
* Most of single queue controllers, there is only one irq vector
* for handling IO completion, and the only irq's affinity is set