Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1742608

[PATCH V5 5/8] block: add check on elevator for supporting bio merge via hashtable from blk-mq sw queue

From Ming Lei <ming.lei@redhat.com>
Newsgroups linux.kernel
Subject [PATCH V5 5/8] block: add check on elevator for supporting bio merge via hashtable from blk-mq sw queue
Date 2017-09-30 13:40 +0200
Message-ID <uvohH-3wm-5@gated-at.bofh.it> (permalink)
References <uvo81-3sE-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


blk_mq_sched_try_merge() will be reused in following patches
to support bio merge to blk-mq sw queue, so add checkes to
related functions which are called from blk_mq_sched_try_merge().

Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Tested-by: Tom Nguyen <tom81094@gmail.com>
Tested-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/elevator.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/block/elevator.c b/block/elevator.c
index e11c7873fc21..2424aea85393 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -71,6 +71,10 @@ bool elv_bio_merge_ok(struct request *rq, struct bio *bio)
 	if (!blk_rq_merge_ok(rq, bio))
 		return false;
 
+	/* We need to support to merge bio from sw queue */
+	if (!rq->q->elevator)
+		return true;
+
 	if (!elv_iosched_allow_bio_merge(rq, bio))
 		return false;
 
@@ -449,6 +453,10 @@ static enum elv_merge __elv_merge(struct request_queue *q,
 		return ELEVATOR_BACK_MERGE;
 	}
 
+	/* no elevator when merging bio to blk-mq sw queue */
+	if (!e)
+		return ELEVATOR_NO_MERGE;
+
 	if (e->uses_mq && e->type->ops.mq.request_merge)
 		return e->type->ops.mq.request_merge(q, req, bio);
 	else if (!e->uses_mq && e->type->ops.sq.elevator_merge_fn)
@@ -711,6 +719,10 @@ struct request *elv_latter_request(struct request_queue *q, struct request *rq)
 {
 	struct elevator_queue *e = q->elevator;
 
+	/* no elevator when merging bio to blk-mq sw queue */
+	if (!e)
+		return NULL;
+
 	if (e->uses_mq && e->type->ops.mq.next_request)
 		return e->type->ops.mq.next_request(q, rq);
 	else if (!e->uses_mq && e->type->ops.sq.elevator_latter_req_fn)
@@ -723,6 +735,10 @@ struct request *elv_former_request(struct request_queue *q, struct request *rq)
 {
 	struct elevator_queue *e = q->elevator;
 
+	/* no elevator when merging bio to blk-mq sw queue */
+	if (!e)
+		return NULL;
+
 	if (e->uses_mq && e->type->ops.mq.former_request)
 		return e->type->ops.mq.former_request(q, rq);
 	if (!e->uses_mq && e->type->ops.sq.elevator_former_req_fn)
-- 
2.9.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V5 0/8] blk-mq: improve bio merge for none scheduler Ming Lei <ming.lei@redhat.com> - 2017-09-30 13:30 +0200
  [PATCH V5 7/8] blk-mq-sched: refactor blk_mq_sched_try_merge() Ming Lei <ming.lei@redhat.com> - 2017-09-30 13:40 +0200
  [PATCH V5 5/8] block: add check on elevator for supporting bio merge via hashtable from blk-mq sw queue Ming Lei <ming.lei@redhat.com> - 2017-09-30 13:40 +0200
  [PATCH V5 2/8] blk-mq-sched: use q->queue_depth as hint for q->nr_requests Ming Lei <ming.lei@redhat.com> - 2017-09-30 13:40 +0200
  [PATCH V5 8/8] blk-mq: improve bio merge from blk-mq sw queue Ming Lei <ming.lei@redhat.com> - 2017-09-30 13:40 +0200
  [PATCH V5 4/8] block: move actual bio merge code into __elv_merge Ming Lei <ming.lei@redhat.com> - 2017-09-30 13:40 +0200
  [PATCH V5 1/8] blk-mq-sched: introduce blk_mq_sched_queue_depth() Ming Lei <ming.lei@redhat.com> - 2017-09-30 13:40 +0200
  [PATCH V5 3/8] block: introduce rqhash helpers Ming Lei <ming.lei@redhat.com> - 2017-09-30 13:40 +0200
  [PATCH V5 6/8] block: introduce .last_merge and .hash to blk_mq_ctx Ming Lei <ming.lei@redhat.com> - 2017-09-30 13:40 +0200

csiph-web