Skip to content

Commit 2753328

Browse files
shroffniaxboe
authored andcommitted
block: skip q->rq_qos check in rq_qos_done_bio()
If a bio has BIO_QOS_THROTTLED or BIO_QOS_MERGED set, it implicitly guarantees that q->rq_qos is present. Avoid re-checking q->rq_qos in this case and call __rq_qos_done_bio() directly as a minor optimization. Suggested-by : Yu Kuai <[email protected]> Signed-off-by: Nilay Shroff <[email protected]> Reviewed-by: Ming Lei <[email protected]> Reviewed-by: Yu Kuai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 2d82f3b commit 2753328

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

block/blk-rq-qos.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,14 @@ static inline void rq_qos_done_bio(struct bio *bio)
142142
bio->bi_bdev && (bio_flagged(bio, BIO_QOS_THROTTLED) ||
143143
bio_flagged(bio, BIO_QOS_MERGED))) {
144144
struct request_queue *q = bdev_get_queue(bio->bi_bdev);
145-
if (q->rq_qos)
146-
__rq_qos_done_bio(q->rq_qos, bio);
145+
146+
/*
147+
* If a bio has BIO_QOS_xxx set, it implicitly implies that
148+
* q->rq_qos is present. So, we skip re-checking q->rq_qos
149+
* here as an extra optimization and directly call
150+
* __rq_qos_done_bio().
151+
*/
152+
__rq_qos_done_bio(q->rq_qos, bio);
147153
}
148154
}
149155

0 commit comments

Comments
 (0)