[PATCH] 04/05 remove last_merge handling from ioscheds
authorTejun Heo <htejun@gmail.com>
Thu, 20 Oct 2005 14:46:54 +0000 (16:46 +0200)
committerJens Axboe <axboe@nelson.home.kernel.dk>
Fri, 28 Oct 2005 06:45:35 +0000 (08:45 +0200)
Remove last_merge handling from all ioscheds.  This patch
removes merging capability of noop iosched.

Signed-off-by: Tejun Heo <htejun@gmail.com>
drivers/block/as-iosched.c
drivers/block/cfq-iosched.c
drivers/block/deadline-iosched.c
drivers/block/noop-iosched.c

index 1775ffe9edc7c42825e8271abf62dd5f5a071366..5d20e4bcbc78f02b389abc1640d8da9fdc30a9da 100644 (file)
@@ -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;
@@ -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;
                }
 
@@ -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);
 }
 
@@ -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);
 }
 
 /*
@@ -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 {
@@ -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
         */
@@ -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));
@@ -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
index 7b14160e0798ab2f7531423281ba5f17f4df5859..62a19ed0443b10a2bce7a0664fb90b424ccaec23 100644 (file)
@@ -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));
@@ -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
@@ -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;
@@ -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;
 }
@@ -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
@@ -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);
 }
 
index 07de4d24ddbad30ad9e18e4e0135e44cfd2ac88b..43d93155efb86412498307f70e4e108f92f4e35d 100644 (file)
@@ -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)
 {
@@ -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;
-       }
 }
 
 /*
@@ -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
@@ -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
         */
@@ -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;
@@ -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
index bc2252b6f2e5fdf553465ed8c269aef70de4c60d..f56b8edb06e42b217b46c9556c23ca30ef6a6063 100644 (file)
@@ -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)
@@ -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,
        },