diff mbox series

[3/6] blk-mq: optimise *end_request non-stat path

Message ID 908aa33b09e1fd6afa14caa719684121f380be71.1633781740.git.asml.silence@gmail.com (mailing list archive)
State New, archived
Headers show
Series some block optimisations | expand

Commit Message

Pavel Begunkov Oct. 9, 2021, 12:25 p.m. UTC
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: Pavel Begunkov <asml.silence@gmail.com>
---
 block/blk-mq.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9430a0def2c9..c3da521efd35 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -584,12 +584,11 @@  static inline void __blk_mq_end_request_acct(struct request *rq,
 
 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();
 
-	__blk_mq_end_request_acct(rq, error, now);
+		__blk_mq_end_request_acct(rq, error, now);
+	}
 
 	if (rq->end_io) {
 		rq_qos_done(rq->q, rq);