Skip to content

Commit

Permalink
[PATCH] 04/05 remove last_merge handling from ioscheds
Browse files Browse the repository at this point in the history
Remove last_merge handling from all ioscheds.  This patch
removes merging capability of noop iosched.

Signed-off-by: Tejun Heo <htejun@gmail.com>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Oct 28, 2005
1 parent 06b8624 commit 98b1147
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 114 deletions.
35 changes: 4 additions & 31 deletions drivers/block/as-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,6 @@ static inline void as_del_arq_hash(struct as_rq *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)
{
struct request *rq = arq->request;
Expand Down Expand Up @@ -330,7 +322,7 @@ static struct request *as_find_arq_hash(struct as_data *ad, sector_t offset)
BUG_ON(!arq->on_hash);

if (!rq_mergeable(__rq)) {
as_remove_merge_hints(ad->q, arq);
as_del_arq_hash(arq);
continue;
}

Expand Down Expand Up @@ -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);

list_del_init(&arq->fifo);
as_remove_merge_hints(q, arq);
as_del_arq_hash(arq);
as_del_arq_rb(ad, arq);
}

Expand Down Expand Up @@ -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.
*/
as_remove_merge_hints(ad->q, arq);
as_del_arq_hash(arq);
}

/*
Expand Down Expand Up @@ -1392,12 +1384,8 @@ static void as_add_request(request_queue_t *q, struct request *rq)
arq->expires = jiffies + ad->fifo_expire[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);

if (!ad->q->last_merge)
ad->q->last_merge = arq->request;
}
as_update_arq(ad, arq); /* keep state machine up to date */

} else {
Expand Down Expand Up @@ -1486,15 +1474,6 @@ as_merge(request_queue_t *q, struct request **req, struct bio *bio)
struct request *__rq;
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
*/
Expand Down Expand Up @@ -1523,9 +1502,6 @@ as_merge(request_queue_t *q, struct request **req, struct bio *bio)

return ELEVATOR_NO_MERGE;
out:
if (rq_mergeable(__rq))
q->last_merge = __rq;
out_insert:
if (ret) {
if (rq_mergeable(__rq))
as_hot_arq_hash(ad, RQ_DATA(__rq));
Expand Down Expand Up @@ -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.
*/
}

if (arq->on_hash)
q->last_merge = req;
}

static void
Expand Down
26 changes: 2 additions & 24 deletions drivers/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,6 @@ static inline void cfq_del_crq_hash(struct cfq_rq *crq)
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)
{
const int hash_idx = CFQ_MHASH_FN(rq_hash_key(crq->request));
Expand Down Expand Up @@ -672,7 +664,7 @@ static void cfq_remove_request(struct request *rq)

list_del_init(&rq->queuelist);
cfq_del_crq_rb(crq);
cfq_remove_merge_hints(rq->q, crq);
cfq_del_crq_hash(crq);
}

static int
Expand All @@ -682,12 +674,6 @@ cfq_merge(request_queue_t *q, struct request **req, struct bio *bio)
struct request *__rq;
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);
if (__rq && elv_rq_merge_ok(__rq, bio)) {
ret = ELEVATOR_BACK_MERGE;
Expand All @@ -702,8 +688,6 @@ cfq_merge(request_queue_t *q, struct request **req, struct bio *bio)

return ELEVATOR_NO_MERGE;
out:
q->last_merge = __rq;
out_insert:
*req = __rq;
return ret;
}
Expand All @@ -722,8 +706,6 @@ static void cfq_merged_request(request_queue_t *q, struct request *req)
cfq_update_next_crq(crq);
cfq_reposition_crq_rb(cfqq, crq);
}

q->last_merge = req;
}

static void
Expand Down Expand Up @@ -1670,13 +1652,9 @@ static void cfq_insert_request(request_queue_t *q, struct request *rq)

list_add_tail(&rq->queuelist, &cfqq->fifo);

if (rq_mergeable(rq)) {
if (rq_mergeable(rq))
cfq_add_crq_hash(cfqd, crq);

if (!cfqd->queue->last_merge)
cfqd->queue->last_merge = rq;
}

cfq_crq_enqueued(cfqd, cfqq, crq);
}

Expand Down
30 changes: 2 additions & 28 deletions drivers/block/deadline-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,6 @@ static inline void deadline_del_drq_hash(struct deadline_rq *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
deadline_add_drq_hash(struct deadline_data *dd, struct deadline_rq *drq)
{
Expand Down Expand Up @@ -299,12 +290,8 @@ deadline_add_request(struct request_queue *q, struct request *rq)
drq->expires = jiffies + dd->fifo_expire[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);

if (!q->last_merge)
q->last_merge = rq;
}
}

/*
Expand All @@ -316,8 +303,8 @@ static void deadline_remove_request(request_queue_t *q, struct request *rq)
struct deadline_data *dd = q->elevator->elevator_data;

list_del_init(&drq->fifo);
deadline_remove_merge_hints(q, drq);
deadline_del_drq_rb(dd, drq);
deadline_del_drq_hash(drq);
}

static int
Expand All @@ -327,15 +314,6 @@ deadline_merge(request_queue_t *q, struct request **req, struct bio *bio)
struct request *__rq;
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
*/
Expand Down Expand Up @@ -368,8 +346,6 @@ deadline_merge(request_queue_t *q, struct request **req, struct bio *bio)

return ELEVATOR_NO_MERGE;
out:
q->last_merge = __rq;
out_insert:
if (ret)
deadline_hot_drq_hash(dd, RQ_DATA(__rq));
*req = __rq;
Expand All @@ -394,8 +370,6 @@ static void deadline_merged_request(request_queue_t *q, struct request *req)
deadline_del_drq_rb(dd, drq);
deadline_add_drq_rb(dd, drq);
}

q->last_merge = req;
}

static void
Expand Down
31 changes: 0 additions & 31 deletions drivers/block/noop-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,9 @@
#include <linux/module.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)
{
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)
Expand All @@ -48,8 +19,6 @@ static int elevator_noop_dispatch(request_queue_t *q, int force)

static struct elevator_type elevator_noop = {
.ops = {
.elevator_merge_fn = elevator_noop_merge,
.elevator_merge_req_fn = elevator_noop_merge_requests,
.elevator_dispatch_fn = elevator_noop_dispatch,
.elevator_add_req_fn = elevator_noop_add_request,
},
Expand Down

0 comments on commit 98b1147

Please sign in to comment.