aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-01-24 10:26:56 +0100
committerJens Axboe <axboe@kernel.dk>2024-02-05 10:03:51 -0700
commit0f299da55ac3d28bc9de23a84fae01a85c4e253a (patch)
tree8018ae7f4456e0d94f59377789d8d03afc7b9a9b /block
parent54be6c6c5ae8e0d93a6c4641cb7528eb0b6ba478 (diff)
downloadlinux-0f299da55ac3d28bc9de23a84fae01a85c4e253a.tar.gz
blk-mq: move blk_mq_attempt_bio_merge out blk_mq_get_new_requests
blk_mq_attempt_bio_merge has nothing to do with allocating a new request, it avoids allocating a new request. Move the call out of blk_mq_get_new_requests and into the only caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Tested-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/20240124092658.2258309-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 2dc01551e27c7d..bc032d06858e1d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2891,9 +2891,6 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
};
struct request *rq;
- if (blk_mq_attempt_bio_merge(q, bio, nsegs))
- return NULL;
-
rq_qos_throttle(q, bio);
if (plug) {
@@ -2992,18 +2989,18 @@ void blk_mq_submit_bio(struct bio *bio)
if (unlikely(bio_may_exceed_limits(bio, &q->limits))) {
bio = __bio_split_to_limits(bio, &q->limits, &nr_segs);
if (!bio)
- goto fail;
+ goto queue_exit;
}
if (!bio_integrity_prep(bio))
- goto fail;
+ goto queue_exit;
}
+ if (blk_mq_attempt_bio_merge(q, bio, nr_segs))
+ goto queue_exit;
+
rq = blk_mq_get_new_requests(q, plug, bio, nr_segs);
- if (unlikely(!rq)) {
-fail:
- blk_queue_exit(q);
- return;
- }
+ if (unlikely(!rq))
+ goto queue_exit;
done:
trace_block_getrq(bio);
@@ -3036,6 +3033,10 @@ done:
} else {
blk_mq_run_dispatch_ops(q, blk_mq_try_issue_directly(hctx, rq));
}
+ return;
+
+queue_exit:
+ blk_queue_exit(q);
}
#ifdef CONFIG_BLK_MQ_STACKING