[PATCH V5 7/8] blk-mq-sched: refactor blk_mq_sched_try_merge()
From: Ming Lei
Date: Sat Sep 30 2017 - 07:32:39 EST
This patch introduces one function __blk_mq_try_merge()
which will be resued for bio merge to sw queue in
the following patch.
No functional change.
Tested-by: Oleksandr Natalenko <oleksandr@xxxxxxxxxxxxxx>
Tested-by: Tom Nguyen <tom81094@xxxxxxxxx>
Tested-by: Paolo Valente <paolo.valente@xxxxxxxxxx>
Reviewed-by: Bart Van Assche <bart.vanassche@xxxxxxx>
Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
---
block/blk-mq-sched.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 8c09959bc0d0..a58f4746317c 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -222,12 +222,11 @@ void blk_mq_sched_dispatch_requests(struct blk_mq_hw_ctx *hctx)
}
}
-bool blk_mq_sched_try_merge(struct request_queue *q, struct bio *bio,
- struct request **merged_request)
+static bool __blk_mq_try_merge(struct request_queue *q,
+ struct bio *bio, struct request **merged_request,
+ struct request *rq, enum elv_merge type)
{
- struct request *rq;
-
- switch (elv_merge(q, &rq, bio)) {
+ switch (type) {
case ELEVATOR_BACK_MERGE:
if (!blk_mq_sched_allow_merge(q, rq, bio))
return false;
@@ -250,6 +249,15 @@ bool blk_mq_sched_try_merge(struct request_queue *q, struct bio *bio,
return false;
}
}
+
+bool blk_mq_sched_try_merge(struct request_queue *q, struct bio *bio,
+ struct request **merged_request)
+{
+ struct request *rq;
+ enum elv_merge type = elv_merge(q, &rq, bio);
+
+ return __blk_mq_try_merge(q, bio, merged_request, rq, type);
+}
EXPORT_SYMBOL_GPL(blk_mq_sched_try_merge);
/*
--
2.9.5