diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-10-20 21:00:49 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-21 16:27:17 +0200 |
commit | 179ae84f7ef5225e03cd29cb9a75f6e90d2d7388 (patch) | |
tree | dc6205b3b64bdd5c8a49ea2b2978809d80c68462 /block/blk-mq.c | |
parent | block: optimise boundary blkdev_read_iter's checks (diff) | |
download | linux-179ae84f7ef5225e03cd29cb9a75f6e90d2d7388.tar.xz linux-179ae84f7ef5225e03cd29cb9a75f6e90d2d7388.zip |
block: clean up blk_mq_submit_bio() merging
Combine blk_mq_sched_bio_merge() and blk_attempt_plug_merge() under a
common if, so we don't check it twice.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/daedc90d4029a5d1d73344771632b1faca3aaf81.1634755800.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 101466ece4c4..d04ee72ba125 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2481,7 +2481,6 @@ void blk_mq_submit_bio(struct bio *bio) { struct request_queue *q = bdev_get_queue(bio->bi_bdev); const int is_sync = op_is_sync(bio->bi_opf); - const int is_flush_fua = op_is_flush(bio->bi_opf); struct request *rq; struct blk_plug *plug; bool same_queue_rq = false; @@ -2495,12 +2494,12 @@ void blk_mq_submit_bio(struct bio *bio) if (!bio_integrity_prep(bio)) goto queue_exit; - if (!is_flush_fua && !blk_queue_nomerges(q) && - blk_attempt_plug_merge(q, bio, nr_segs, &same_queue_rq)) - goto queue_exit; - - if (blk_mq_sched_bio_merge(q, bio, nr_segs)) - goto queue_exit; + if (!blk_queue_nomerges(q) && bio_mergeable(bio)) { + if (blk_attempt_plug_merge(q, bio, nr_segs, &same_queue_rq)) + goto queue_exit; + if (blk_mq_sched_bio_merge(q, bio, nr_segs)) + goto queue_exit; + } rq_qos_throttle(q, bio); @@ -2543,7 +2542,7 @@ void blk_mq_submit_bio(struct bio *bio) return; } - if (is_flush_fua && blk_insert_flush(rq)) + if (op_is_flush(bio->bi_opf) && blk_insert_flush(rq)) return; if (plug && (q->nr_hw_queues == 1 || |