aboutsummaryrefslogtreecommitdiffstats
path: root/block/elevator.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c75
1 files changed, 40 insertions, 35 deletions
diff --git a/block/elevator.c b/block/elevator.c
index d265963d1ed3..c6d153de9fd6 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -56,7 +56,7 @@ static const int elv_hash_shift = 6;
56 */ 56 */
57static int elv_iosched_allow_merge(struct request *rq, struct bio *bio) 57static int elv_iosched_allow_merge(struct request *rq, struct bio *bio)
58{ 58{
59 request_queue_t *q = rq->q; 59 struct request_queue *q = rq->q;
60 elevator_t *e = q->elevator; 60 elevator_t *e = q->elevator;
61 61
62 if (e->ops->elevator_allow_merge_fn) 62 if (e->ops->elevator_allow_merge_fn)
@@ -141,12 +141,13 @@ static struct elevator_type *elevator_get(const char *name)
141 return e; 141 return e;
142} 142}
143 143
144static void *elevator_init_queue(request_queue_t *q, struct elevator_queue *eq) 144static void *elevator_init_queue(struct request_queue *q,
145 struct elevator_queue *eq)
145{ 146{
146 return eq->ops->elevator_init_fn(q); 147 return eq->ops->elevator_init_fn(q);
147} 148}
148 149
149static void elevator_attach(request_queue_t *q, struct elevator_queue *eq, 150static void elevator_attach(struct request_queue *q, struct elevator_queue *eq,
150 void *data) 151 void *data)
151{ 152{
152 q->elevator = eq; 153 q->elevator = eq;
@@ -172,7 +173,8 @@ __setup("elevator=", elevator_setup);
172 173
173static struct kobj_type elv_ktype; 174static struct kobj_type elv_ktype;
174 175
175static elevator_t *elevator_alloc(request_queue_t *q, struct elevator_type *e) 176static elevator_t *elevator_alloc(struct request_queue *q,
177 struct elevator_type *e)
176{ 178{
177 elevator_t *eq; 179 elevator_t *eq;
178 int i; 180 int i;
@@ -212,7 +214,7 @@ static void elevator_release(struct kobject *kobj)
212 kfree(e); 214 kfree(e);
213} 215}
214 216
215int elevator_init(request_queue_t *q, char *name) 217int elevator_init(struct request_queue *q, char *name)
216{ 218{
217 struct elevator_type *e = NULL; 219 struct elevator_type *e = NULL;
218 struct elevator_queue *eq; 220 struct elevator_queue *eq;
@@ -264,7 +266,7 @@ void elevator_exit(elevator_t *e)
264 266
265EXPORT_SYMBOL(elevator_exit); 267EXPORT_SYMBOL(elevator_exit);
266 268
267static void elv_activate_rq(request_queue_t *q, struct request *rq) 269static void elv_activate_rq(struct request_queue *q, struct request *rq)
268{ 270{
269 elevator_t *e = q->elevator; 271 elevator_t *e = q->elevator;
270 272
@@ -272,7 +274,7 @@ static void elv_activate_rq(request_queue_t *q, struct request *rq)
272 e->ops->elevator_activate_req_fn(q, rq); 274 e->ops->elevator_activate_req_fn(q, rq);
273} 275}
274 276
275static void elv_deactivate_rq(request_queue_t *q, struct request *rq) 277static void elv_deactivate_rq(struct request_queue *q, struct request *rq)
276{ 278{
277 elevator_t *e = q->elevator; 279 elevator_t *e = q->elevator;
278 280
@@ -285,13 +287,13 @@ static inline void __elv_rqhash_del(struct request *rq)
285 hlist_del_init(&rq->hash); 287 hlist_del_init(&rq->hash);
286} 288}
287 289
288static void elv_rqhash_del(request_queue_t *q, struct request *rq) 290static void elv_rqhash_del(struct request_queue *q, struct request *rq)
289{ 291{
290 if (ELV_ON_HASH(rq)) 292 if (ELV_ON_HASH(rq))
291 __elv_rqhash_del(rq); 293 __elv_rqhash_del(rq);
292} 294}
293 295
294static void elv_rqhash_add(request_queue_t *q, struct request *rq) 296static void elv_rqhash_add(struct request_queue *q, struct request *rq)
295{ 297{
296 elevator_t *e = q->elevator; 298 elevator_t *e = q->elevator;
297 299
@@ -299,13 +301,13 @@ static void elv_rqhash_add(request_queue_t *q, struct request *rq)
299 hlist_add_head(&rq->hash, &e->hash[ELV_HASH_FN(rq_hash_key(rq))]); 301 hlist_add_head(&rq->hash, &e->hash[ELV_HASH_FN(rq_hash_key(rq))]);
300} 302}
301 303
302static void elv_rqhash_reposition(request_queue_t *q, struct request *rq) 304static void elv_rqhash_reposition(struct request_queue *q, struct request *rq)
303{ 305{
304 __elv_rqhash_del(rq); 306 __elv_rqhash_del(rq);
305 elv_rqhash_add(q, rq); 307 elv_rqhash_add(q, rq);
306} 308}
307 309
308static struct request *elv_rqhash_find(request_queue_t *q, sector_t offset) 310static struct request *elv_rqhash_find(struct request_queue *q, sector_t offset)
309{ 311{
310 elevator_t *e = q->elevator; 312 elevator_t *e = q->elevator;
311 struct hlist_head *hash_list = &e->hash[ELV_HASH_FN(offset)]; 313 struct hlist_head *hash_list = &e->hash[ELV_HASH_FN(offset)];
@@ -391,7 +393,7 @@ EXPORT_SYMBOL(elv_rb_find);
391 * entry. rq is sort insted into the dispatch queue. To be used by 393 * entry. rq is sort insted into the dispatch queue. To be used by
392 * specific elevators. 394 * specific elevators.
393 */ 395 */
394void elv_dispatch_sort(request_queue_t *q, struct request *rq) 396void elv_dispatch_sort(struct request_queue *q, struct request *rq)
395{ 397{
396 sector_t boundary; 398 sector_t boundary;
397 struct list_head *entry; 399 struct list_head *entry;
@@ -449,7 +451,7 @@ void elv_dispatch_add_tail(struct request_queue *q, struct request *rq)
449 451
450EXPORT_SYMBOL(elv_dispatch_add_tail); 452EXPORT_SYMBOL(elv_dispatch_add_tail);
451 453
452int elv_merge(request_queue_t *q, struct request **req, struct bio *bio) 454int elv_merge(struct request_queue *q, struct request **req, struct bio *bio)
453{ 455{
454 elevator_t *e = q->elevator; 456 elevator_t *e = q->elevator;
455 struct request *__rq; 457 struct request *__rq;
@@ -481,7 +483,7 @@ int elv_merge(request_queue_t *q, struct request **req, struct bio *bio)
481 return ELEVATOR_NO_MERGE; 483 return ELEVATOR_NO_MERGE;
482} 484}
483 485
484void elv_merged_request(request_queue_t *q, struct request *rq, int type) 486void elv_merged_request(struct request_queue *q, struct request *rq, int type)
485{ 487{
486 elevator_t *e = q->elevator; 488 elevator_t *e = q->elevator;
487 489
@@ -494,7 +496,7 @@ void elv_merged_request(request_queue_t *q, struct request *rq, int type)
494 q->last_merge = rq; 496 q->last_merge = rq;
495} 497}
496 498
497void elv_merge_requests(request_queue_t *q, struct request *rq, 499void elv_merge_requests(struct request_queue *q, struct request *rq,
498 struct request *next) 500 struct request *next)
499{ 501{
500 elevator_t *e = q->elevator; 502 elevator_t *e = q->elevator;
@@ -509,7 +511,7 @@ void elv_merge_requests(request_queue_t *q, struct request *rq,
509 q->last_merge = rq; 511 q->last_merge = rq;
510} 512}
511 513
512void elv_requeue_request(request_queue_t *q, struct request *rq) 514void elv_requeue_request(struct request_queue *q, struct request *rq)
513{ 515{
514 /* 516 /*
515 * it already went through dequeue, we need to decrement the 517 * it already went through dequeue, we need to decrement the
@@ -526,7 +528,7 @@ void elv_requeue_request(request_queue_t *q, struct request *rq)
526 elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE); 528 elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE);
527} 529}
528 530
529static void elv_drain_elevator(request_queue_t *q) 531static void elv_drain_elevator(struct request_queue *q)
530{ 532{
531 static int printed; 533 static int printed;
532 while (q->elevator->ops->elevator_dispatch_fn(q, 1)) 534 while (q->elevator->ops->elevator_dispatch_fn(q, 1))
@@ -540,7 +542,7 @@ static void elv_drain_elevator(request_queue_t *q)
540 } 542 }
541} 543}
542 544
543void elv_insert(request_queue_t *q, struct request *rq, int where) 545void elv_insert(struct request_queue *q, struct request *rq, int where)
544{ 546{
545 struct list_head *pos; 547 struct list_head *pos;
546 unsigned ordseq; 548 unsigned ordseq;
@@ -638,7 +640,7 @@ void elv_insert(request_queue_t *q, struct request *rq, int where)
638 } 640 }
639} 641}
640 642
641void __elv_add_request(request_queue_t *q, struct request *rq, int where, 643void __elv_add_request(struct request_queue *q, struct request *rq, int where,
642 int plug) 644 int plug)
643{ 645{
644 if (q->ordcolor) 646 if (q->ordcolor)
@@ -676,7 +678,7 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where,
676 678
677EXPORT_SYMBOL(__elv_add_request); 679EXPORT_SYMBOL(__elv_add_request);
678 680
679void elv_add_request(request_queue_t *q, struct request *rq, int where, 681void elv_add_request(struct request_queue *q, struct request *rq, int where,
680 int plug) 682 int plug)
681{ 683{
682 unsigned long flags; 684 unsigned long flags;
@@ -688,7 +690,7 @@ void elv_add_request(request_queue_t *q, struct request *rq, int where,
688 690
689EXPORT_SYMBOL(elv_add_request); 691EXPORT_SYMBOL(elv_add_request);
690 692
691static inline struct request *__elv_next_request(request_queue_t *q) 693static inline struct request *__elv_next_request(struct request_queue *q)
692{ 694{
693 struct request *rq; 695 struct request *rq;
694 696
@@ -704,7 +706,7 @@ static inline struct request *__elv_next_request(request_queue_t *q)
704 } 706 }
705} 707}
706 708
707struct request *elv_next_request(request_queue_t *q) 709struct request *elv_next_request(struct request_queue *q)
708{ 710{
709 struct request *rq; 711 struct request *rq;
710 int ret; 712 int ret;
@@ -770,7 +772,7 @@ struct request *elv_next_request(request_queue_t *q)
770 772
771EXPORT_SYMBOL(elv_next_request); 773EXPORT_SYMBOL(elv_next_request);
772 774
773void elv_dequeue_request(request_queue_t *q, struct request *rq) 775void elv_dequeue_request(struct request_queue *q, struct request *rq)
774{ 776{
775 BUG_ON(list_empty(&rq->queuelist)); 777 BUG_ON(list_empty(&rq->queuelist));
776 BUG_ON(ELV_ON_HASH(rq)); 778 BUG_ON(ELV_ON_HASH(rq));
@@ -788,7 +790,7 @@ void elv_dequeue_request(request_queue_t *q, struct request *rq)
788 790
789EXPORT_SYMBOL(elv_dequeue_request); 791EXPORT_SYMBOL(elv_dequeue_request);
790 792
791int elv_queue_empty(request_queue_t *q) 793int elv_queue_empty(struct request_queue *q)
792{ 794{
793 elevator_t *e = q->elevator; 795 elevator_t *e = q->elevator;
794 796
@@ -803,7 +805,7 @@ int elv_queue_empty(request_queue_t *q)
803 805
804EXPORT_SYMBOL(elv_queue_empty); 806EXPORT_SYMBOL(elv_queue_empty);
805 807
806struct request *elv_latter_request(request_queue_t *q, struct request *rq) 808struct request *elv_latter_request(struct request_queue *q, struct request *rq)
807{ 809{
808 elevator_t *e = q->elevator; 810 elevator_t *e = q->elevator;
809 811
@@ -812,7 +814,7 @@ struct request *elv_latter_request(request_queue_t *q, struct request *rq)
812 return NULL; 814 return NULL;
813} 815}
814 816
815struct request *elv_former_request(request_queue_t *q, struct request *rq) 817struct request *elv_former_request(struct request_queue *q, struct request *rq)
816{ 818{
817 elevator_t *e = q->elevator; 819 elevator_t *e = q->elevator;
818 820
@@ -821,7 +823,7 @@ struct request *elv_former_request(request_queue_t *q, struct request *rq)
821 return NULL; 823 return NULL;
822} 824}
823 825
824int elv_set_request(request_queue_t *q, struct request *rq, gfp_t gfp_mask) 826int elv_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask)
825{ 827{
826 elevator_t *e = q->elevator; 828 elevator_t *e = q->elevator;
827 829
@@ -832,7 +834,7 @@ int elv_set_request(request_queue_t *q, struct request *rq, gfp_t gfp_mask)
832 return 0; 834 return 0;
833} 835}
834 836
835void elv_put_request(request_queue_t *q, struct request *rq) 837void elv_put_request(struct request_queue *q, struct request *rq)
836{ 838{
837 elevator_t *e = q->elevator; 839 elevator_t *e = q->elevator;
838 840
@@ -840,7 +842,7 @@ void elv_put_request(request_queue_t *q, struct request *rq)
840 e->ops->elevator_put_req_fn(rq); 842 e->ops->elevator_put_req_fn(rq);
841} 843}
842 844
843int elv_may_queue(request_queue_t *q, int rw) 845int elv_may_queue(struct request_queue *q, int rw)
844{ 846{
845 elevator_t *e = q->elevator; 847 elevator_t *e = q->elevator;
846 848
@@ -850,7 +852,7 @@ int elv_may_queue(request_queue_t *q, int rw)
850 return ELV_MQUEUE_MAY; 852 return ELV_MQUEUE_MAY;
851} 853}
852 854
853void elv_completed_request(request_queue_t *q, struct request *rq) 855void elv_completed_request(struct request_queue *q, struct request *rq)
854{ 856{
855 elevator_t *e = q->elevator; 857 elevator_t *e = q->elevator;
856 858
@@ -1006,7 +1008,7 @@ EXPORT_SYMBOL_GPL(elv_unregister);
1006 * need for the new one. this way we have a chance of going back to the old 1008 * need for the new one. this way we have a chance of going back to the old
1007 * one, if the new one fails init for some reason. 1009 * one, if the new one fails init for some reason.
1008 */ 1010 */
1009static int elevator_switch(request_queue_t *q, struct elevator_type *new_e) 1011static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
1010{ 1012{
1011 elevator_t *old_elevator, *e; 1013 elevator_t *old_elevator, *e;
1012 void *data; 1014 void *data;
@@ -1078,7 +1080,8 @@ fail_register:
1078 return 0; 1080 return 0;
1079} 1081}
1080 1082
1081ssize_t elv_iosched_store(request_queue_t *q, const char *name, size_t count) 1083ssize_t elv_iosched_store(struct request_queue *q, const char *name,
1084 size_t count)
1082{ 1085{
1083 char elevator_name[ELV_NAME_MAX]; 1086 char elevator_name[ELV_NAME_MAX];
1084 size_t len; 1087 size_t len;
@@ -1107,7 +1110,7 @@ ssize_t elv_iosched_store(request_queue_t *q, const char *name, size_t count)
1107 return count; 1110 return count;
1108} 1111}
1109 1112
1110ssize_t elv_iosched_show(request_queue_t *q, char *name) 1113ssize_t elv_iosched_show(struct request_queue *q, char *name)
1111{ 1114{
1112 elevator_t *e = q->elevator; 1115 elevator_t *e = q->elevator;
1113 struct elevator_type *elv = e->elevator_type; 1116 struct elevator_type *elv = e->elevator_type;
@@ -1127,7 +1130,8 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name)
1127 return len; 1130 return len;
1128} 1131}
1129 1132
1130struct request *elv_rb_former_request(request_queue_t *q, struct request *rq) 1133struct request *elv_rb_former_request(struct request_queue *q,
1134 struct request *rq)
1131{ 1135{
1132 struct rb_node *rbprev = rb_prev(&rq->rb_node); 1136 struct rb_node *rbprev = rb_prev(&rq->rb_node);
1133 1137
@@ -1139,7 +1143,8 @@ struct request *elv_rb_former_request(request_queue_t *q, struct request *rq)
1139 1143
1140EXPORT_SYMBOL(elv_rb_former_request); 1144EXPORT_SYMBOL(elv_rb_former_request);
1141 1145
1142struct request *elv_rb_latter_request(request_queue_t *q, struct request *rq) 1146struct request *elv_rb_latter_request(struct request_queue *q,
1147 struct request *rq)
1143{ 1148{
1144 struct rb_node *rbnext = rb_next(&rq->rb_node); 1149 struct rb_node *rbnext = rb_next(&rq->rb_node);
1145 1150