mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
blk-mq: simplify blk_mq_make_request()
Move the blk_mq_bio_to_request() call in front of the if-statement. Cc: Hannes Reinecke <hare@suse.com> Cc: Omar Sandoval <osandov@fb.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
c05f42206f
commit
970d168de6
@ -1971,10 +1971,10 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
|
|||||||
|
|
||||||
cookie = request_to_qc_t(data.hctx, rq);
|
cookie = request_to_qc_t(data.hctx, rq);
|
||||||
|
|
||||||
|
blk_mq_bio_to_request(rq, bio, nr_segs);
|
||||||
|
|
||||||
plug = current->plug;
|
plug = current->plug;
|
||||||
if (unlikely(is_flush_fua)) {
|
if (unlikely(is_flush_fua)) {
|
||||||
blk_mq_bio_to_request(rq, bio, nr_segs);
|
|
||||||
|
|
||||||
/* bypass scheduler for flush rq */
|
/* bypass scheduler for flush rq */
|
||||||
blk_insert_flush(rq);
|
blk_insert_flush(rq);
|
||||||
blk_mq_run_hw_queue(data.hctx, true);
|
blk_mq_run_hw_queue(data.hctx, true);
|
||||||
@ -1986,8 +1986,6 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
|
|||||||
unsigned int request_count = plug->rq_count;
|
unsigned int request_count = plug->rq_count;
|
||||||
struct request *last = NULL;
|
struct request *last = NULL;
|
||||||
|
|
||||||
blk_mq_bio_to_request(rq, bio, nr_segs);
|
|
||||||
|
|
||||||
if (!request_count)
|
if (!request_count)
|
||||||
trace_block_plug(q);
|
trace_block_plug(q);
|
||||||
else
|
else
|
||||||
@ -2001,8 +1999,6 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
|
|||||||
|
|
||||||
blk_add_rq_to_plug(plug, rq);
|
blk_add_rq_to_plug(plug, rq);
|
||||||
} else if (plug && !blk_queue_nomerges(q)) {
|
} else if (plug && !blk_queue_nomerges(q)) {
|
||||||
blk_mq_bio_to_request(rq, bio, nr_segs);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We do limited plugging. If the bio can be merged, do that.
|
* We do limited plugging. If the bio can be merged, do that.
|
||||||
* Otherwise the existing request in the plug list will be
|
* Otherwise the existing request in the plug list will be
|
||||||
@ -2027,10 +2023,8 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
|
|||||||
}
|
}
|
||||||
} else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator &&
|
} else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator &&
|
||||||
!data.hctx->dispatch_busy)) {
|
!data.hctx->dispatch_busy)) {
|
||||||
blk_mq_bio_to_request(rq, bio, nr_segs);
|
|
||||||
blk_mq_try_issue_directly(data.hctx, rq, &cookie);
|
blk_mq_try_issue_directly(data.hctx, rq, &cookie);
|
||||||
} else {
|
} else {
|
||||||
blk_mq_bio_to_request(rq, bio, nr_segs);
|
|
||||||
blk_mq_sched_insert_request(rq, false, true, true);
|
blk_mq_sched_insert_request(rq, false, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user