summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-09-25 13:38:37 -0700
committerKent Overstreet <kmo@daterainc.com>2014-06-17 18:26:01 -0700
commit72e9f7ff1fd38ada4eebc6aecb5e45ebd629940f (patch)
tree56a6a6b5a3b31a39223d1e4af28d4f1558b2071f
parentd1c9c75d6f2aeabeab5162a5d529385c4d2f7359 (diff)
kill ll_merge_requests_fn
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
-rw-r--r--block/blk-merge.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 3e6629e43324..b69bed9206a6 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -453,38 +453,6 @@ static bool req_no_special_merge(struct request *req)
return !q->mq_ops && req->special;
}
-static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
- struct request *next)
-{
- int total_phys_segments;
-
- /*
- * First check if the either of the requests are re-queued
- * requests. Can't merge them if they are.
- */
- if (req_no_special_merge(req) || req_no_special_merge(next))
- return 0;
-
- /*
- * Will it become too large?
- */
- if ((blk_rq_sectors(req) + blk_rq_sectors(next)) >
- blk_rq_get_max_sectors(req))
- return 0;
-
- total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
-
- if (total_phys_segments > queue_max_segments(q))
- return 0;
-
- if (blk_integrity_rq(req) && blk_integrity_merge_rq(q, req, next))
- return 0;
-
- /* Merge is OK... */
- req->nr_phys_segments = total_phys_segments;
- return 1;
-}
-
/**
* blk_rq_set_mixed_merge - mark a request as mixed merge
* @rq: request to mark as mixed merge
@@ -538,6 +506,8 @@ static void blk_account_io_merge(struct request *req)
static int attempt_merge(struct request_queue *q, struct request *req,
struct request *next)
{
+ unsigned total_phys_segments;
+
if (!rq_mergeable(req) || !rq_mergeable(next))
return 0;
@@ -550,6 +520,13 @@ static int attempt_merge(struct request_queue *q, struct request *req,
if (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next))
return 0;
+ /*
+ * check if the either of the requests are re-queued
+ * requests. Can't merge them if they are.
+ */
+ if (req->special || next->special)
+ return 0;
+
if (rq_data_dir(req) != rq_data_dir(next)
|| req->rq_disk != next->rq_disk
|| req_no_special_merge(next))
@@ -560,14 +537,22 @@ static int attempt_merge(struct request_queue *q, struct request *req,
return 0;
/*
- * If we are allowed to merge, then append bio list
- * from next to rq and release next. merge_requests_fn
- * will have updated segment counts, update sector
- * counts here.
+ * Will it become too large?
*/
- if (!ll_merge_requests_fn(q, req, next))
+ if ((blk_rq_sectors(req) + blk_rq_sectors(next)) >
+ blk_rq_get_max_sectors(req))
+ return 0;
+
+ total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
+ if (total_phys_segments > queue_max_segments(q))
return 0;
+ if (blk_integrity_rq(req) && blk_integrity_merge_rq(q, req, next))
+ return 0;
+
+ /* Merge is OK... */
+ req->nr_phys_segments = total_phys_segments;
+
/*
* If failfast settings disagree or any of the two is already
* a mixed merge, mark both as mixed before proceeding. This