aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2005-10-20 10:46:54 -0400
committerJens Axboe <axboe@nelson.home.kernel.dk>2005-10-28 02:45:35 -0400
commit98b11471d72a374f346bec50a00d0887719b85b3 (patch)
tree875feb99eacd983fdc9107eb1c3b68f24e641aa4
parent06b86245c052963029bfd9020ca1f08ceb66f85a (diff)
[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: Tejun Heo <htejun@gmail.com>
-rw-r--r--drivers/block/as-iosched.c35
-rw-r--r--drivers/block/cfq-iosched.c26
-rw-r--r--drivers/block/deadline-iosched.c30
-rw-r--r--drivers/block/noop-iosched.c31
4 files changed, 8 insertions, 114 deletions
diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c
index 1775ffe9edc7..5d20e4bcbc78 100644
--- a/drivers/block/as-iosched.c
+++ b/drivers/block/as-iosched.c
@@ -279,14 +279,6 @@ static inline void as_del_arq_hash(struct as_rq *arq)
279 __as_del_arq_hash(arq); 279 __as_del_arq_hash(arq);
280} 280}
281 281
282static void as_remove_merge_hints(request_queue_t *q, struct as_rq *arq)
283{
284 as_del_arq_hash(arq);
285
286 if (q->last_merge == arq->request)
287 q->last_merge = NULL;
288}
289
290static void as_add_arq_hash(struct as_data *ad, struct as_rq *arq) 282static void as_add_arq_hash(struct as_data *ad, struct as_rq *arq)
291{ 283{
292 struct request *rq = arq->request; 284 struct request *rq = arq->request;
@@ -330,7 +322,7 @@ static struct request *as_find_arq_hash(struct as_data *ad, sector_t offset)
330 BUG_ON(!arq->on_hash); 322 BUG_ON(!arq->on_hash);
331 323
332 if (!rq_mergeable(__rq)) { 324 if (!rq_mergeable(__rq)) {
333 as_remove_merge_hints(ad->q, arq); 325 as_del_arq_hash(arq);
334 continue; 326 continue;
335 } 327 }
336 328
@@ -1040,7 +1032,7 @@ static void as_remove_queued_request(request_queue_t *q, struct request *rq)
1040 ad->next_arq[data_dir] = as_find_next_arq(ad, arq); 1032 ad->next_arq[data_dir] = as_find_next_arq(ad, arq);
1041 1033
1042 list_del_init(&arq->fifo); 1034 list_del_init(&arq->fifo);
1043 as_remove_merge_hints(q, arq); 1035 as_del_arq_hash(arq);
1044 as_del_arq_rb(ad, arq); 1036 as_del_arq_rb(ad, arq);
1045} 1037}
1046 1038
@@ -1351,7 +1343,7 @@ as_add_aliased_request(struct as_data *ad, struct as_rq *arq, struct as_rq *alia
1351 /* 1343 /*
1352 * Don't want to have to handle merges. 1344 * Don't want to have to handle merges.
1353 */ 1345 */
1354 as_remove_merge_hints(ad->q, arq); 1346 as_del_arq_hash(arq);
1355} 1347}
1356 1348
1357/* 1349/*
@@ -1392,12 +1384,8 @@ static void as_add_request(request_queue_t *q, struct request *rq)
1392 arq->expires = jiffies + ad->fifo_expire[data_dir]; 1384 arq->expires = jiffies + ad->fifo_expire[data_dir];
1393 list_add_tail(&arq->fifo, &ad->fifo_list[data_dir]); 1385 list_add_tail(&arq->fifo, &ad->fifo_list[data_dir]);
1394 1386
1395 if (rq_mergeable(arq->request)) { 1387 if (rq_mergeable(arq->request))
1396 as_add_arq_hash(ad, arq); 1388 as_add_arq_hash(ad, arq);
1397
1398 if (!ad->q->last_merge)
1399 ad->q->last_merge = arq->request;
1400 }
1401 as_update_arq(ad, arq); /* keep state machine up to date */ 1389 as_update_arq(ad, arq); /* keep state machine up to date */
1402 1390
1403 } else { 1391 } else {
@@ -1487,15 +1475,6 @@ as_merge(request_queue_t *q, struct request **req, struct bio *bio)
1487 int ret; 1475 int ret;
1488 1476
1489 /* 1477 /*
1490 * try last_merge to avoid going to hash
1491 */
1492 ret = elv_try_last_merge(q, bio);
1493 if (ret != ELEVATOR_NO_MERGE) {
1494 __rq = q->last_merge;
1495 goto out_insert;
1496 }
1497
1498 /*
1499 * see if the merge hash can satisfy a back merge 1478 * see if the merge hash can satisfy a back merge
1500 */ 1479 */
1501 __rq = as_find_arq_hash(ad, bio->bi_sector); 1480 __rq = as_find_arq_hash(ad, bio->bi_sector);
@@ -1523,9 +1502,6 @@ as_merge(request_queue_t *q, struct request **req, struct bio *bio)
1523 1502
1524 return ELEVATOR_NO_MERGE; 1503 return ELEVATOR_NO_MERGE;
1525out: 1504out:
1526 if (rq_mergeable(__rq))
1527 q->last_merge = __rq;
1528out_insert:
1529 if (ret) { 1505 if (ret) {
1530 if (rq_mergeable(__rq)) 1506 if (rq_mergeable(__rq))
1531 as_hot_arq_hash(ad, RQ_DATA(__rq)); 1507 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 * behind the disk head. We currently don't bother adjusting. 1548 * behind the disk head. We currently don't bother adjusting.
1573 */ 1549 */
1574 } 1550 }
1575
1576 if (arq->on_hash)
1577 q->last_merge = req;
1578} 1551}
1579 1552
1580static void 1553static void
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c
index 7b14160e0798..62a19ed0443b 100644
--- a/drivers/block/cfq-iosched.c
+++ b/drivers/block/cfq-iosched.c
@@ -304,14 +304,6 @@ static inline void cfq_del_crq_hash(struct cfq_rq *crq)
304 hlist_del_init(&crq->hash); 304 hlist_del_init(&crq->hash);
305} 305}
306 306
307static void cfq_remove_merge_hints(request_queue_t *q, struct cfq_rq *crq)
308{
309 cfq_del_crq_hash(crq);
310
311 if (q->last_merge == crq->request)
312 q->last_merge = NULL;
313}
314
315static inline void cfq_add_crq_hash(struct cfq_data *cfqd, struct cfq_rq *crq) 307static inline void cfq_add_crq_hash(struct cfq_data *cfqd, struct cfq_rq *crq)
316{ 308{
317 const int hash_idx = CFQ_MHASH_FN(rq_hash_key(crq->request)); 309 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 664
673 list_del_init(&rq->queuelist); 665 list_del_init(&rq->queuelist);
674 cfq_del_crq_rb(crq); 666 cfq_del_crq_rb(crq);
675 cfq_remove_merge_hints(rq->q, crq); 667 cfq_del_crq_hash(crq);
676} 668}
677 669
678static int 670static int
@@ -682,12 +674,6 @@ cfq_merge(request_queue_t *q, struct request **req, struct bio *bio)
682 struct request *__rq; 674 struct request *__rq;
683 int ret; 675 int ret;
684 676
685 ret = elv_try_last_merge(q, bio);
686 if (ret != ELEVATOR_NO_MERGE) {
687 __rq = q->last_merge;
688 goto out_insert;
689 }
690
691 __rq = cfq_find_rq_hash(cfqd, bio->bi_sector); 677 __rq = cfq_find_rq_hash(cfqd, bio->bi_sector);
692 if (__rq && elv_rq_merge_ok(__rq, bio)) { 678 if (__rq && elv_rq_merge_ok(__rq, bio)) {
693 ret = ELEVATOR_BACK_MERGE; 679 ret = ELEVATOR_BACK_MERGE;
@@ -702,8 +688,6 @@ cfq_merge(request_queue_t *q, struct request **req, struct bio *bio)
702 688
703 return ELEVATOR_NO_MERGE; 689 return ELEVATOR_NO_MERGE;
704out: 690out:
705 q->last_merge = __rq;
706out_insert:
707 *req = __rq; 691 *req = __rq;
708 return ret; 692 return ret;
709} 693}
@@ -722,8 +706,6 @@ static void cfq_merged_request(request_queue_t *q, struct request *req)
722 cfq_update_next_crq(crq); 706 cfq_update_next_crq(crq);
723 cfq_reposition_crq_rb(cfqq, crq); 707 cfq_reposition_crq_rb(cfqq, crq);
724 } 708 }
725
726 q->last_merge = req;
727} 709}
728 710
729static void 711static void
@@ -1670,13 +1652,9 @@ static void cfq_insert_request(request_queue_t *q, struct request *rq)
1670 1652
1671 list_add_tail(&rq->queuelist, &cfqq->fifo); 1653 list_add_tail(&rq->queuelist, &cfqq->fifo);
1672 1654
1673 if (rq_mergeable(rq)) { 1655 if (rq_mergeable(rq))
1674 cfq_add_crq_hash(cfqd, crq); 1656 cfq_add_crq_hash(cfqd, crq);
1675 1657
1676 if (!cfqd->queue->last_merge)
1677 cfqd->queue->last_merge = rq;
1678 }
1679
1680 cfq_crq_enqueued(cfqd, cfqq, crq); 1658 cfq_crq_enqueued(cfqd, cfqq, crq);
1681} 1659}
1682 1660
diff --git a/drivers/block/deadline-iosched.c b/drivers/block/deadline-iosched.c
index 07de4d24ddba..43d93155efb8 100644
--- a/drivers/block/deadline-iosched.c
+++ b/drivers/block/deadline-iosched.c
@@ -112,15 +112,6 @@ static inline void deadline_del_drq_hash(struct deadline_rq *drq)
112 __deadline_del_drq_hash(drq); 112 __deadline_del_drq_hash(drq);
113} 113}
114 114
115static void
116deadline_remove_merge_hints(request_queue_t *q, struct deadline_rq *drq)
117{
118 deadline_del_drq_hash(drq);
119
120 if (q->last_merge == drq->request)
121 q->last_merge = NULL;
122}
123
124static inline void 115static inline void
125deadline_add_drq_hash(struct deadline_data *dd, struct deadline_rq *drq) 116deadline_add_drq_hash(struct deadline_data *dd, struct deadline_rq *drq)
126{ 117{
@@ -299,12 +290,8 @@ deadline_add_request(struct request_queue *q, struct request *rq)
299 drq->expires = jiffies + dd->fifo_expire[data_dir]; 290 drq->expires = jiffies + dd->fifo_expire[data_dir];
300 list_add_tail(&drq->fifo, &dd->fifo_list[data_dir]); 291 list_add_tail(&drq->fifo, &dd->fifo_list[data_dir]);
301 292
302 if (rq_mergeable(rq)) { 293 if (rq_mergeable(rq))
303 deadline_add_drq_hash(dd, drq); 294 deadline_add_drq_hash(dd, drq);
304
305 if (!q->last_merge)
306 q->last_merge = rq;
307 }
308} 295}
309 296
310/* 297/*
@@ -316,8 +303,8 @@ static void deadline_remove_request(request_queue_t *q, struct request *rq)
316 struct deadline_data *dd = q->elevator->elevator_data; 303 struct deadline_data *dd = q->elevator->elevator_data;
317 304
318 list_del_init(&drq->fifo); 305 list_del_init(&drq->fifo);
319 deadline_remove_merge_hints(q, drq);
320 deadline_del_drq_rb(dd, drq); 306 deadline_del_drq_rb(dd, drq);
307 deadline_del_drq_hash(drq);
321} 308}
322 309
323static int 310static int
@@ -328,15 +315,6 @@ deadline_merge(request_queue_t *q, struct request **req, struct bio *bio)
328 int ret; 315 int ret;
329 316
330 /* 317 /*
331 * try last_merge to avoid going to hash
332 */
333 ret = elv_try_last_merge(q, bio);
334 if (ret != ELEVATOR_NO_MERGE) {
335 __rq = q->last_merge;
336 goto out_insert;
337 }
338
339 /*
340 * see if the merge hash can satisfy a back merge 318 * see if the merge hash can satisfy a back merge
341 */ 319 */
342 __rq = deadline_find_drq_hash(dd, bio->bi_sector); 320 __rq = deadline_find_drq_hash(dd, bio->bi_sector);
@@ -368,8 +346,6 @@ deadline_merge(request_queue_t *q, struct request **req, struct bio *bio)
368 346
369 return ELEVATOR_NO_MERGE; 347 return ELEVATOR_NO_MERGE;
370out: 348out:
371 q->last_merge = __rq;
372out_insert:
373 if (ret) 349 if (ret)
374 deadline_hot_drq_hash(dd, RQ_DATA(__rq)); 350 deadline_hot_drq_hash(dd, RQ_DATA(__rq));
375 *req = __rq; 351 *req = __rq;
@@ -394,8 +370,6 @@ static void deadline_merged_request(request_queue_t *q, struct request *req)
394 deadline_del_drq_rb(dd, drq); 370 deadline_del_drq_rb(dd, drq);
395 deadline_add_drq_rb(dd, drq); 371 deadline_add_drq_rb(dd, drq);
396 } 372 }
397
398 q->last_merge = req;
399} 373}
400 374
401static void 375static void
diff --git a/drivers/block/noop-iosched.c b/drivers/block/noop-iosched.c
index bc2252b6f2e5..f56b8edb06e4 100644
--- a/drivers/block/noop-iosched.c
+++ b/drivers/block/noop-iosched.c
@@ -7,38 +7,9 @@
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/init.h> 8#include <linux/init.h>
9 9
10/*
11 * See if we can find a request that this buffer can be coalesced with.
12 */
13static int elevator_noop_merge(request_queue_t *q, struct request **req,
14 struct bio *bio)
15{
16 int ret;
17
18 ret = elv_try_last_merge(q, bio);
19 if (ret != ELEVATOR_NO_MERGE)
20 *req = q->last_merge;
21
22 return ret;
23}
24
25static void elevator_noop_merge_requests(request_queue_t *q, struct request *req,
26 struct request *next)
27{
28 list_del_init(&next->queuelist);
29}
30
31static void elevator_noop_add_request(request_queue_t *q, struct request *rq) 10static void elevator_noop_add_request(request_queue_t *q, struct request *rq)
32{ 11{
33 elv_dispatch_add_tail(q, rq); 12 elv_dispatch_add_tail(q, rq);
34
35 /*
36 * new merges must not precede this barrier
37 */
38 if (rq->flags & REQ_HARDBARRIER)
39 q->last_merge = NULL;
40 else if (!q->last_merge)
41 q->last_merge = rq;
42} 13}
43 14
44static int elevator_noop_dispatch(request_queue_t *q, int force) 15static 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 19
49static struct elevator_type elevator_noop = { 20static struct elevator_type elevator_noop = {
50 .ops = { 21 .ops = {
51 .elevator_merge_fn = elevator_noop_merge,
52 .elevator_merge_req_fn = elevator_noop_merge_requests,
53 .elevator_dispatch_fn = elevator_noop_dispatch, 22 .elevator_dispatch_fn = elevator_noop_dispatch,
54 .elevator_add_req_fn = elevator_noop_add_request, 23 .elevator_add_req_fn = elevator_noop_add_request,
55 }, 24 },