Skip to content

Commit 4bc6339

Browse files
osandovaxboe
authored andcommitted
block: move blk_stat_add() to __blk_mq_end_request()
We want this next to blk_account_io_done() for the next change so that we can call ktime_get() only once for both. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 84c7afc commit 4bc6339

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

block/blk-mq.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,11 @@ EXPORT_SYMBOL_GPL(blk_mq_free_request);
506506

507507
inline void __blk_mq_end_request(struct request *rq, blk_status_t error)
508508
{
509+
if (rq->rq_flags & RQF_STATS) {
510+
blk_mq_poll_stats_start(rq->q);
511+
blk_stat_add(rq);
512+
}
513+
509514
blk_account_io_done(rq);
510515

511516
if (rq->end_io) {
@@ -545,10 +550,6 @@ static void __blk_mq_complete_request(struct request *rq)
545550

546551
if (rq->internal_tag != -1)
547552
blk_mq_sched_completed_request(rq);
548-
if (rq->rq_flags & RQF_STATS) {
549-
blk_mq_poll_stats_start(rq->q);
550-
blk_stat_add(rq);
551-
}
552553

553554
if (!test_bit(QUEUE_FLAG_SAME_COMP, &rq->q->queue_flags)) {
554555
rq->q->softirq_done_fn(rq);

0 commit comments

Comments
 (0)