Commit 98b11471 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

[PATCH] 04/05 remove last_merge handling from ioscheds

Remove last_merge handling from all ioscheds.  This patch
removes merging capability of noop iosched.
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
parent 06b86245
...@@ -279,14 +279,6 @@ static inline void as_del_arq_hash(struct as_rq *arq) ...@@ -279,14 +279,6 @@ static inline void as_del_arq_hash(struct as_rq *arq)
__as_del_arq_hash(arq); __as_del_arq_hash(arq);
} }
static void as_remove_merge_hints(request_queue_t *q, struct as_rq *arq)
{
as_del_arq_hash(arq);
if (q->last_merge == arq->request)
q->last_merge = NULL;
}
static void as_add_arq_hash(struct as_data *ad, struct as_rq *arq) static void as_add_arq_hash(struct as_data *ad, struct as_rq *arq)
{ {
struct request *rq = arq->request; struct request *rq = arq->request;
...@@ -330,7 +322,7 @@ static struct request *as_find_arq_hash(struct as_data *ad, sector_t offset) ...@@ -330,7 +322,7 @@ static struct request *as_find_arq_hash(struct as_data *ad, sector_t offset)
BUG_ON(!arq->on_hash); BUG_ON(!arq->on_hash);
if (!rq_mergeable(__rq)) { if (!rq_mergeable(__rq)) {
as_remove_merge_hints(ad->q, arq); as_del_arq_hash(arq);
continue; continue;
} }
...@@ -1040,7 +1032,7 @@ static void as_remove_queued_request(request_queue_t *q, struct request *rq) ...@@ -1040,7 +1032,7 @@ static void as_remove_queued_request(request_queue_t *q, struct request *rq)
ad->next_arq[data_dir] = as_find_next_arq(ad, arq); ad->next_arq[data_dir] = as_find_next_arq(ad, arq);
list_del_init(&arq->fifo); list_del_init(&arq->fifo);
as_remove_merge_hints(q, arq); as_del_arq_hash(arq);
as_del_arq_rb(ad, arq); as_del_arq_rb(ad, arq);
} }
...@@ -1351,7 +1343,7 @@ as_add_aliased_request(struct as_data *ad, struct as_rq *arq, struct as_rq *alia ...@@ -1351,7 +1343,7 @@ as_add_aliased_request(struct as_data *ad, struct as_rq *arq, struct as_rq *alia
/* /*
* Don't want to have to handle merges. * Don't want to have to handle merges.
*/ */
as_remove_merge_hints(ad->q, arq); as_del_arq_hash(arq);
} }
/* /*
...@@ -1392,12 +1384,8 @@ static void as_add_request(request_queue_t *q, struct request *rq) ...@@ -1392,12 +1384,8 @@ static void as_add_request(request_queue_t *q, struct request *rq)
arq->expires = jiffies + ad->fifo_expire[data_dir]; arq->expires = jiffies + ad->fifo_expire[data_dir];
list_add_tail(&arq->fifo, &ad->fifo_list[data_dir]); list_add_tail(&arq->fifo, &ad->fifo_list[data_dir]);
if (rq_mergeable(arq->request)) { if (rq_mergeable(arq->request))
as_add_arq_hash(ad, arq); as_add_arq_hash(ad, arq);
if (!ad->q->last_merge)
ad->q->last_merge = arq->request;
}
as_update_arq(ad, arq); /* keep state machine up to date */ as_update_arq(ad, arq); /* keep state machine up to date */
} else { } else {
...@@ -1486,15 +1474,6 @@ as_merge(request_queue_t *q, struct request **req, struct bio *bio) ...@@ -1486,15 +1474,6 @@ as_merge(request_queue_t *q, struct request **req, struct bio *bio)
struct request *__rq; struct request *__rq;
int ret; int ret;
/*
* try last_merge to avoid going to hash
*/
ret = elv_try_last_merge(q, bio);
if (ret != ELEVATOR_NO_MERGE) {
__rq = q->last_merge;
goto out_insert;
}
/* /*
* see if the merge hash can satisfy a back merge * see if the merge hash can satisfy a back merge
*/ */
...@@ -1523,9 +1502,6 @@ as_merge(request_queue_t *q, struct request **req, struct bio *bio) ...@@ -1523,9 +1502,6 @@ as_merge(request_queue_t *q, struct request **req, struct bio *bio)
return ELEVATOR_NO_MERGE; return ELEVATOR_NO_MERGE;
out: out:
if (rq_mergeable(__rq))
q->last_merge = __rq;
out_insert:
if (ret) { if (ret) {
if (rq_mergeable(__rq)) if (rq_mergeable(__rq))
as_hot_arq_hash(ad, RQ_DATA(__rq)); as_hot_arq_hash(ad, RQ_DATA(__rq));
...@@ -1572,9 +1548,6 @@ static void as_merged_request(request_queue_t *q, struct request *req) ...@@ -1572,9 +1548,6 @@ static void as_merged_request(request_queue_t *q, struct request *req)
* behind the disk head. We currently don't bother adjusting. * behind the disk head. We currently don't bother adjusting.
*/ */
} }
if (arq->on_hash)
q->last_merge = req;
} }
static void static void
......
...@@ -304,14 +304,6 @@ static inline void cfq_del_crq_hash(struct cfq_rq *crq) ...@@ -304,14 +304,6 @@ static inline void cfq_del_crq_hash(struct cfq_rq *crq)
hlist_del_init(&crq->hash); hlist_del_init(&crq->hash);
} }
static void cfq_remove_merge_hints(request_queue_t *q, struct cfq_rq *crq)
{
cfq_del_crq_hash(crq);
if (q->last_merge == crq->request)
q->last_merge = NULL;
}
static inline void cfq_add_crq_hash(struct cfq_data *cfqd, struct cfq_rq *crq) static inline void cfq_add_crq_hash(struct cfq_data *cfqd, struct cfq_rq *crq)
{ {
const int hash_idx = CFQ_MHASH_FN(rq_hash_key(crq->request)); const int hash_idx = CFQ_MHASH_FN(rq_hash_key(crq->request));
...@@ -672,7 +664,7 @@ static void cfq_remove_request(struct request *rq) ...@@ -672,7 +664,7 @@ static void cfq_remove_request(struct request *rq)
list_del_init(&rq->queuelist); list_del_init(&rq->queuelist);
cfq_del_crq_rb(crq); cfq_del_crq_rb(crq);
cfq_remove_merge_hints(rq->q, crq); cfq_del_crq_hash(crq);
} }
static int static int
...@@ -682,12 +674,6 @@ cfq_merge(request_queue_t *q, struct request **req, struct bio *bio) ...@@ -682,12 +674,6 @@ cfq_merge(request_queue_t *q, struct request **req, struct bio *bio)
struct request *__rq; struct request *__rq;
int ret; int ret;
ret = elv_try_last_merge(q, bio);
if (ret != ELEVATOR_NO_MERGE) {
__rq = q->last_merge;
goto out_insert;
}
__rq = cfq_find_rq_hash(cfqd, bio->bi_sector); __rq = cfq_find_rq_hash(cfqd, bio->bi_sector);
if (__rq && elv_rq_merge_ok(__rq, bio)) { if (__rq && elv_rq_merge_ok(__rq, bio)) {
ret = ELEVATOR_BACK_MERGE; ret = ELEVATOR_BACK_MERGE;
...@@ -702,8 +688,6 @@ cfq_merge(request_queue_t *q, struct request **req, struct bio *bio) ...@@ -702,8 +688,6 @@ cfq_merge(request_queue_t *q, struct request **req, struct bio *bio)
return ELEVATOR_NO_MERGE; return ELEVATOR_NO_MERGE;
out: out:
q->last_merge = __rq;
out_insert:
*req = __rq; *req = __rq;
return ret; return ret;
} }
...@@ -722,8 +706,6 @@ static void cfq_merged_request(request_queue_t *q, struct request *req) ...@@ -722,8 +706,6 @@ static void cfq_merged_request(request_queue_t *q, struct request *req)
cfq_update_next_crq(crq); cfq_update_next_crq(crq);
cfq_reposition_crq_rb(cfqq, crq); cfq_reposition_crq_rb(cfqq, crq);
} }
q->last_merge = req;
} }
static void static void
...@@ -1670,13 +1652,9 @@ static void cfq_insert_request(request_queue_t *q, struct request *rq) ...@@ -1670,13 +1652,9 @@ static void cfq_insert_request(request_queue_t *q, struct request *rq)
list_add_tail(&rq->queuelist, &cfqq->fifo); list_add_tail(&rq->queuelist, &cfqq->fifo);
if (rq_mergeable(rq)) { if (rq_mergeable(rq))
cfq_add_crq_hash(cfqd, crq); cfq_add_crq_hash(cfqd, crq);
if (!cfqd->queue->last_merge)
cfqd->queue->last_merge = rq;
}
cfq_crq_enqueued(cfqd, cfqq, crq); cfq_crq_enqueued(cfqd, cfqq, crq);
} }
......
...@@ -112,15 +112,6 @@ static inline void deadline_del_drq_hash(struct deadline_rq *drq) ...@@ -112,15 +112,6 @@ static inline void deadline_del_drq_hash(struct deadline_rq *drq)
__deadline_del_drq_hash(drq); __deadline_del_drq_hash(drq);
} }
static void
deadline_remove_merge_hints(request_queue_t *q, struct deadline_rq *drq)
{
deadline_del_drq_hash(drq);
if (q->last_merge == drq->request)
q->last_merge = NULL;
}
static inline void static inline void
deadline_add_drq_hash(struct deadline_data *dd, struct deadline_rq *drq) deadline_add_drq_hash(struct deadline_data *dd, struct deadline_rq *drq)
{ {
...@@ -299,12 +290,8 @@ deadline_add_request(struct request_queue *q, struct request *rq) ...@@ -299,12 +290,8 @@ deadline_add_request(struct request_queue *q, struct request *rq)
drq->expires = jiffies + dd->fifo_expire[data_dir]; drq->expires = jiffies + dd->fifo_expire[data_dir];
list_add_tail(&drq->fifo, &dd->fifo_list[data_dir]); list_add_tail(&drq->fifo, &dd->fifo_list[data_dir]);
if (rq_mergeable(rq)) { if (rq_mergeable(rq))
deadline_add_drq_hash(dd, drq); deadline_add_drq_hash(dd, drq);
if (!q->last_merge)
q->last_merge = rq;
}
} }
/* /*
...@@ -316,8 +303,8 @@ static void deadline_remove_request(request_queue_t *q, struct request *rq) ...@@ -316,8 +303,8 @@ static void deadline_remove_request(request_queue_t *q, struct request *rq)
struct deadline_data *dd = q->elevator->elevator_data; struct deadline_data *dd = q->elevator->elevator_data;
list_del_init(&drq->fifo); list_del_init(&drq->fifo);
deadline_remove_merge_hints(q, drq);
deadline_del_drq_rb(dd, drq); deadline_del_drq_rb(dd, drq);
deadline_del_drq_hash(drq);
} }
static int static int
...@@ -327,15 +314,6 @@ deadline_merge(request_queue_t *q, struct request **req, struct bio *bio) ...@@ -327,15 +314,6 @@ deadline_merge(request_queue_t *q, struct request **req, struct bio *bio)
struct request *__rq; struct request *__rq;
int ret; int ret;
/*
* try last_merge to avoid going to hash
*/
ret = elv_try_last_merge(q, bio);
if (ret != ELEVATOR_NO_MERGE) {
__rq = q->last_merge;
goto out_insert;
}
/* /*
* see if the merge hash can satisfy a back merge * see if the merge hash can satisfy a back merge
*/ */
...@@ -368,8 +346,6 @@ deadline_merge(request_queue_t *q, struct request **req, struct bio *bio) ...@@ -368,8 +346,6 @@ deadline_merge(request_queue_t *q, struct request **req, struct bio *bio)
return ELEVATOR_NO_MERGE; return ELEVATOR_NO_MERGE;
out: out:
q->last_merge = __rq;
out_insert:
if (ret) if (ret)
deadline_hot_drq_hash(dd, RQ_DATA(__rq)); deadline_hot_drq_hash(dd, RQ_DATA(__rq));
*req = __rq; *req = __rq;
...@@ -394,8 +370,6 @@ static void deadline_merged_request(request_queue_t *q, struct request *req) ...@@ -394,8 +370,6 @@ static void deadline_merged_request(request_queue_t *q, struct request *req)
deadline_del_drq_rb(dd, drq); deadline_del_drq_rb(dd, drq);
deadline_add_drq_rb(dd, drq); deadline_add_drq_rb(dd, drq);
} }
q->last_merge = req;
} }
static void static void
......
...@@ -7,38 +7,9 @@ ...@@ -7,38 +7,9 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
/*
* See if we can find a request that this buffer can be coalesced with.
*/
static int elevator_noop_merge(request_queue_t *q, struct request **req,
struct bio *bio)
{
int ret;
ret = elv_try_last_merge(q, bio);
if (ret != ELEVATOR_NO_MERGE)
*req = q->last_merge;
return ret;
}
static void elevator_noop_merge_requests(request_queue_t *q, struct request *req,
struct request *next)
{
list_del_init(&next->queuelist);
}
static void elevator_noop_add_request(request_queue_t *q, struct request *rq) static void elevator_noop_add_request(request_queue_t *q, struct request *rq)
{ {
elv_dispatch_add_tail(q, rq); elv_dispatch_add_tail(q, rq);
/*
* new merges must not precede this barrier
*/
if (rq->flags & REQ_HARDBARRIER)
q->last_merge = NULL;
else if (!q->last_merge)
q->last_merge = rq;
} }
static int elevator_noop_dispatch(request_queue_t *q, int force) static int elevator_noop_dispatch(request_queue_t *q, int force)
...@@ -48,8 +19,6 @@ static int elevator_noop_dispatch(request_queue_t *q, int force) ...@@ -48,8 +19,6 @@ static int elevator_noop_dispatch(request_queue_t *q, int force)
static struct elevator_type elevator_noop = { static struct elevator_type elevator_noop = {
.ops = { .ops = {
.elevator_merge_fn = elevator_noop_merge,
.elevator_merge_req_fn = elevator_noop_merge_requests,
.elevator_dispatch_fn = elevator_noop_dispatch, .elevator_dispatch_fn = elevator_noop_dispatch,
.elevator_add_req_fn = elevator_noop_add_request, .elevator_add_req_fn = elevator_noop_add_request,
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment