Commit 8971a3b7 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe
Browse files

blk-mq: optimise *end_request non-stat path



We already have a blk_mq_need_time_stamp() check in
__blk_mq_end_request() to get a timestamp, hide all the statistics
accounting under it. It cuts some cycles for requests that don't need
stats, and is free otherwise.

Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/e0f2ea812e93a8adcd07101212e7d7e70ca304e7.1634115360.git.asml.silence@gmail.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 4f7ab09a
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -579,10 +579,8 @@ void blk_mq_free_plug_rqs(struct blk_plug *plug)

inline void __blk_mq_end_request(struct request *rq, blk_status_t error)
{
	u64 now = 0;

	if (blk_mq_need_time_stamp(rq))
		now = ktime_get_ns();
	if (blk_mq_need_time_stamp(rq)) {
		u64 now = ktime_get_ns();

		if (rq->rq_flags & RQF_STATS) {
			blk_mq_poll_stats_start(rq->q);
@@ -590,8 +588,8 @@ inline void __blk_mq_end_request(struct request *rq, blk_status_t error)
		}

		blk_mq_sched_completed_request(rq, now);

		blk_account_io_done(rq, now);
	}

	if (rq->end_io) {
		rq_qos_done(rq->q, rq);