[BLOCK] elevator init fixes #2
[linux-3.10.git] / block / elevator.c
1 /*
2  *  linux/drivers/block/elevator.c
3  *
4  *  Block device elevator/IO-scheduler.
5  *
6  *  Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE
7  *
8  * 30042000 Jens Axboe <axboe@suse.de> :
9  *
10  * Split the elevator a bit so that it is possible to choose a different
11  * one or even write a new "plug in". There are three pieces:
12  * - elevator_fn, inserts a new request in the queue list
13  * - elevator_merge_fn, decides whether a new buffer can be merged with
14  *   an existing request
15  * - elevator_dequeue_fn, called when a request is taken off the active list
16  *
17  * 20082000 Dave Jones <davej@suse.de> :
18  * Removed tests for max-bomb-segments, which was breaking elvtune
19  *  when run without -bN
20  *
21  * Jens:
22  * - Rework again to work with bio instead of buffer_heads
23  * - loose bi_dev comparisons, partition handling is right now
24  * - completely modularize elevator setup and teardown
25  *
26  */
27 #include <linux/kernel.h>
28 #include <linux/fs.h>
29 #include <linux/blkdev.h>
30 #include <linux/elevator.h>
31 #include <linux/bio.h>
32 #include <linux/config.h>
33 #include <linux/module.h>
34 #include <linux/slab.h>
35 #include <linux/init.h>
36 #include <linux/compiler.h>
37 #include <linux/delay.h>
38
39 #include <asm/uaccess.h>
40
41 static DEFINE_SPINLOCK(elv_list_lock);
42 static LIST_HEAD(elv_list);
43
44 /*
45  * can we safely merge with this request?
46  */
47 inline int elv_rq_merge_ok(struct request *rq, struct bio *bio)
48 {
49         if (!rq_mergeable(rq))
50                 return 0;
51
52         /*
53          * different data direction or already started, don't merge
54          */
55         if (bio_data_dir(bio) != rq_data_dir(rq))
56                 return 0;
57
58         /*
59          * same device and no special stuff set, merge is ok
60          */
61         if (rq->rq_disk == bio->bi_bdev->bd_disk &&
62             !rq->waiting && !rq->special)
63                 return 1;
64
65         return 0;
66 }
67 EXPORT_SYMBOL(elv_rq_merge_ok);
68
69 inline int elv_try_merge(struct request *__rq, struct bio *bio)
70 {
71         int ret = ELEVATOR_NO_MERGE;
72
73         /*
74          * we can merge and sequence is ok, check if it's possible
75          */
76         if (elv_rq_merge_ok(__rq, bio)) {
77                 if (__rq->sector + __rq->nr_sectors == bio->bi_sector)
78                         ret = ELEVATOR_BACK_MERGE;
79                 else if (__rq->sector - bio_sectors(bio) == bio->bi_sector)
80                         ret = ELEVATOR_FRONT_MERGE;
81         }
82
83         return ret;
84 }
85 EXPORT_SYMBOL(elv_try_merge);
86
87 static struct elevator_type *elevator_find(const char *name)
88 {
89         struct elevator_type *e = NULL;
90         struct list_head *entry;
91
92         list_for_each(entry, &elv_list) {
93                 struct elevator_type *__e;
94
95                 __e = list_entry(entry, struct elevator_type, list);
96
97                 if (!strcmp(__e->elevator_name, name)) {
98                         e = __e;
99                         break;
100                 }
101         }
102
103         return e;
104 }
105
106 static void elevator_put(struct elevator_type *e)
107 {
108         module_put(e->elevator_owner);
109 }
110
111 static struct elevator_type *elevator_get(const char *name)
112 {
113         struct elevator_type *e;
114
115         spin_lock_irq(&elv_list_lock);
116
117         e = elevator_find(name);
118         if (e && !try_module_get(e->elevator_owner))
119                 e = NULL;
120
121         spin_unlock_irq(&elv_list_lock);
122
123         return e;
124 }
125
126 static int elevator_attach(request_queue_t *q, struct elevator_type *e,
127                            struct elevator_queue *eq)
128 {
129         int ret = 0;
130
131         memset(eq, 0, sizeof(*eq));
132         eq->ops = &e->ops;
133         eq->elevator_type = e;
134
135         q->elevator = eq;
136
137         if (eq->ops->elevator_init_fn)
138                 ret = eq->ops->elevator_init_fn(q, eq);
139
140         return ret;
141 }
142
143 static char chosen_elevator[16];
144
145 static void elevator_setup_default(void)
146 {
147         struct elevator_type *e;
148
149         /*
150          * If default has not been set, use the compiled-in selection.
151          */
152         if (!chosen_elevator[0])
153                 strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED);
154
155         /*
156          * If the given scheduler is not available, fall back to no-op.
157          */
158         if ((e = elevator_find(chosen_elevator)))
159                 elevator_put(e);
160         else
161                 strcpy(chosen_elevator, "noop");
162 }
163
164 static int __init elevator_setup(char *str)
165 {
166         strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1);
167         return 0;
168 }
169
170 __setup("elevator=", elevator_setup);
171
172 int elevator_init(request_queue_t *q, char *name)
173 {
174         struct elevator_type *e = NULL;
175         struct elevator_queue *eq;
176         int ret = 0;
177
178         INIT_LIST_HEAD(&q->queue_head);
179         q->last_merge = NULL;
180         q->end_sector = 0;
181         q->boundary_rq = NULL;
182
183         elevator_setup_default();
184
185         if (!name)
186                 name = chosen_elevator;
187
188         e = elevator_get(name);
189         if (!e)
190                 return -EINVAL;
191
192         eq = kmalloc(sizeof(struct elevator_queue), GFP_KERNEL);
193         if (!eq) {
194                 elevator_put(e);
195                 return -ENOMEM;
196         }
197
198         ret = elevator_attach(q, e, eq);
199         if (ret) {
200                 kfree(eq);
201                 elevator_put(e);
202         }
203
204         return ret;
205 }
206
207 void elevator_exit(elevator_t *e)
208 {
209         if (e->ops->elevator_exit_fn)
210                 e->ops->elevator_exit_fn(e);
211
212         elevator_put(e->elevator_type);
213         e->elevator_type = NULL;
214         kfree(e);
215 }
216
217 /*
218  * Insert rq into dispatch queue of q.  Queue lock must be held on
219  * entry.  If sort != 0, rq is sort-inserted; otherwise, rq will be
220  * appended to the dispatch queue.  To be used by specific elevators.
221  */
222 void elv_dispatch_sort(request_queue_t *q, struct request *rq)
223 {
224         sector_t boundary;
225         struct list_head *entry;
226
227         if (q->last_merge == rq)
228                 q->last_merge = NULL;
229
230         boundary = q->end_sector;
231
232         list_for_each_prev(entry, &q->queue_head) {
233                 struct request *pos = list_entry_rq(entry);
234
235                 if (pos->flags & (REQ_SOFTBARRIER|REQ_HARDBARRIER|REQ_STARTED))
236                         break;
237                 if (rq->sector >= boundary) {
238                         if (pos->sector < boundary)
239                                 continue;
240                 } else {
241                         if (pos->sector >= boundary)
242                                 break;
243                 }
244                 if (rq->sector >= pos->sector)
245                         break;
246         }
247
248         list_add(&rq->queuelist, entry);
249 }
250
251 int elv_merge(request_queue_t *q, struct request **req, struct bio *bio)
252 {
253         elevator_t *e = q->elevator;
254         int ret;
255
256         if (q->last_merge) {
257                 ret = elv_try_merge(q->last_merge, bio);
258                 if (ret != ELEVATOR_NO_MERGE) {
259                         *req = q->last_merge;
260                         return ret;
261                 }
262         }
263
264         if (e->ops->elevator_merge_fn)
265                 return e->ops->elevator_merge_fn(q, req, bio);
266
267         return ELEVATOR_NO_MERGE;
268 }
269
270 void elv_merged_request(request_queue_t *q, struct request *rq)
271 {
272         elevator_t *e = q->elevator;
273
274         if (e->ops->elevator_merged_fn)
275                 e->ops->elevator_merged_fn(q, rq);
276
277         q->last_merge = rq;
278 }
279
280 void elv_merge_requests(request_queue_t *q, struct request *rq,
281                              struct request *next)
282 {
283         elevator_t *e = q->elevator;
284
285         if (e->ops->elevator_merge_req_fn)
286                 e->ops->elevator_merge_req_fn(q, rq, next);
287
288         q->last_merge = rq;
289 }
290
291 void elv_requeue_request(request_queue_t *q, struct request *rq)
292 {
293         elevator_t *e = q->elevator;
294
295         /*
296          * it already went through dequeue, we need to decrement the
297          * in_flight count again
298          */
299         if (blk_account_rq(rq)) {
300                 q->in_flight--;
301                 if (blk_sorted_rq(rq) && e->ops->elevator_deactivate_req_fn)
302                         e->ops->elevator_deactivate_req_fn(q, rq);
303         }
304
305         rq->flags &= ~REQ_STARTED;
306
307         /*
308          * if this is the flush, requeue the original instead and drop the flush
309          */
310         if (rq->flags & REQ_BAR_FLUSH) {
311                 clear_bit(QUEUE_FLAG_FLUSH, &q->queue_flags);
312                 rq = rq->end_io_data;
313         }
314
315         __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0);
316 }
317
318 void __elv_add_request(request_queue_t *q, struct request *rq, int where,
319                        int plug)
320 {
321         if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) {
322                 /*
323                  * barriers implicitly indicate back insertion
324                  */
325                 if (where == ELEVATOR_INSERT_SORT)
326                         where = ELEVATOR_INSERT_BACK;
327
328                 /*
329                  * this request is scheduling boundary, update end_sector
330                  */
331                 if (blk_fs_request(rq)) {
332                         q->end_sector = rq_end_sector(rq);
333                         q->boundary_rq = rq;
334                 }
335         } else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT)
336                 where = ELEVATOR_INSERT_BACK;
337
338         if (plug)
339                 blk_plug_device(q);
340
341         rq->q = q;
342
343         switch (where) {
344         case ELEVATOR_INSERT_FRONT:
345                 rq->flags |= REQ_SOFTBARRIER;
346
347                 list_add(&rq->queuelist, &q->queue_head);
348                 break;
349
350         case ELEVATOR_INSERT_BACK:
351                 rq->flags |= REQ_SOFTBARRIER;
352
353                 while (q->elevator->ops->elevator_dispatch_fn(q, 1))
354                         ;
355                 list_add_tail(&rq->queuelist, &q->queue_head);
356                 /*
357                  * We kick the queue here for the following reasons.
358                  * - The elevator might have returned NULL previously
359                  *   to delay requests and returned them now.  As the
360                  *   queue wasn't empty before this request, ll_rw_blk
361                  *   won't run the queue on return, resulting in hang.
362                  * - Usually, back inserted requests won't be merged
363                  *   with anything.  There's no point in delaying queue
364                  *   processing.
365                  */
366                 blk_remove_plug(q);
367                 q->request_fn(q);
368                 break;
369
370         case ELEVATOR_INSERT_SORT:
371                 BUG_ON(!blk_fs_request(rq));
372                 rq->flags |= REQ_SORTED;
373                 if (q->last_merge == NULL && rq_mergeable(rq))
374                         q->last_merge = rq;
375                 /*
376                  * Some ioscheds (cfq) run q->request_fn directly, so
377                  * rq cannot be accessed after calling
378                  * elevator_add_req_fn.
379                  */
380                 q->elevator->ops->elevator_add_req_fn(q, rq);
381                 break;
382
383         default:
384                 printk(KERN_ERR "%s: bad insertion point %d\n",
385                        __FUNCTION__, where);
386                 BUG();
387         }
388
389         if (blk_queue_plugged(q)) {
390                 int nrq = q->rq.count[READ] + q->rq.count[WRITE]
391                         - q->in_flight;
392
393                 if (nrq >= q->unplug_thresh)
394                         __generic_unplug_device(q);
395         }
396 }
397
398 void elv_add_request(request_queue_t *q, struct request *rq, int where,
399                      int plug)
400 {
401         unsigned long flags;
402
403         spin_lock_irqsave(q->queue_lock, flags);
404         __elv_add_request(q, rq, where, plug);
405         spin_unlock_irqrestore(q->queue_lock, flags);
406 }
407
408 static inline struct request *__elv_next_request(request_queue_t *q)
409 {
410         struct request *rq;
411
412         if (unlikely(list_empty(&q->queue_head) &&
413                      !q->elevator->ops->elevator_dispatch_fn(q, 0)))
414                 return NULL;
415
416         rq = list_entry_rq(q->queue_head.next);
417
418         /*
419          * if this is a barrier write and the device has to issue a
420          * flush sequence to support it, check how far we are
421          */
422         if (blk_fs_request(rq) && blk_barrier_rq(rq)) {
423                 BUG_ON(q->ordered == QUEUE_ORDERED_NONE);
424
425                 if (q->ordered == QUEUE_ORDERED_FLUSH &&
426                     !blk_barrier_preflush(rq))
427                         rq = blk_start_pre_flush(q, rq);
428         }
429
430         return rq;
431 }
432
433 struct request *elv_next_request(request_queue_t *q)
434 {
435         struct request *rq;
436         int ret;
437
438         while ((rq = __elv_next_request(q)) != NULL) {
439                 if (!(rq->flags & REQ_STARTED)) {
440                         elevator_t *e = q->elevator;
441
442                         /*
443                          * This is the first time the device driver
444                          * sees this request (possibly after
445                          * requeueing).  Notify IO scheduler.
446                          */
447                         if (blk_sorted_rq(rq) &&
448                             e->ops->elevator_activate_req_fn)
449                                 e->ops->elevator_activate_req_fn(q, rq);
450
451                         /*
452                          * just mark as started even if we don't start
453                          * it, a request that has been delayed should
454                          * not be passed by new incoming requests
455                          */
456                         rq->flags |= REQ_STARTED;
457                 }
458
459                 if (!q->boundary_rq || q->boundary_rq == rq) {
460                         q->end_sector = rq_end_sector(rq);
461                         q->boundary_rq = NULL;
462                 }
463
464                 if ((rq->flags & REQ_DONTPREP) || !q->prep_rq_fn)
465                         break;
466
467                 ret = q->prep_rq_fn(q, rq);
468                 if (ret == BLKPREP_OK) {
469                         break;
470                 } else if (ret == BLKPREP_DEFER) {
471                         /*
472                          * the request may have been (partially) prepped.
473                          * we need to keep this request in the front to
474                          * avoid resource deadlock.  REQ_STARTED will
475                          * prevent other fs requests from passing this one.
476                          */
477                         rq = NULL;
478                         break;
479                 } else if (ret == BLKPREP_KILL) {
480                         int nr_bytes = rq->hard_nr_sectors << 9;
481
482                         if (!nr_bytes)
483                                 nr_bytes = rq->data_len;
484
485                         blkdev_dequeue_request(rq);
486                         rq->flags |= REQ_QUIET;
487                         end_that_request_chunk(rq, 0, nr_bytes);
488                         end_that_request_last(rq);
489                 } else {
490                         printk(KERN_ERR "%s: bad return=%d\n", __FUNCTION__,
491                                                                 ret);
492                         break;
493                 }
494         }
495
496         return rq;
497 }
498
499 void elv_dequeue_request(request_queue_t *q, struct request *rq)
500 {
501         BUG_ON(list_empty(&rq->queuelist));
502
503         list_del_init(&rq->queuelist);
504
505         /*
506          * the time frame between a request being removed from the lists
507          * and to it is freed is accounted as io that is in progress at
508          * the driver side.
509          */
510         if (blk_account_rq(rq))
511                 q->in_flight++;
512 }
513
514 int elv_queue_empty(request_queue_t *q)
515 {
516         elevator_t *e = q->elevator;
517
518         if (!list_empty(&q->queue_head))
519                 return 0;
520
521         if (e->ops->elevator_queue_empty_fn)
522                 return e->ops->elevator_queue_empty_fn(q);
523
524         return 1;
525 }
526
527 struct request *elv_latter_request(request_queue_t *q, struct request *rq)
528 {
529         struct list_head *next;
530
531         elevator_t *e = q->elevator;
532
533         if (e->ops->elevator_latter_req_fn)
534                 return e->ops->elevator_latter_req_fn(q, rq);
535
536         next = rq->queuelist.next;
537         if (next != &q->queue_head && next != &rq->queuelist)
538                 return list_entry_rq(next);
539
540         return NULL;
541 }
542
543 struct request *elv_former_request(request_queue_t *q, struct request *rq)
544 {
545         struct list_head *prev;
546
547         elevator_t *e = q->elevator;
548
549         if (e->ops->elevator_former_req_fn)
550                 return e->ops->elevator_former_req_fn(q, rq);
551
552         prev = rq->queuelist.prev;
553         if (prev != &q->queue_head && prev != &rq->queuelist)
554                 return list_entry_rq(prev);
555
556         return NULL;
557 }
558
559 int elv_set_request(request_queue_t *q, struct request *rq, struct bio *bio,
560                     gfp_t gfp_mask)
561 {
562         elevator_t *e = q->elevator;
563
564         if (e->ops->elevator_set_req_fn)
565                 return e->ops->elevator_set_req_fn(q, rq, bio, gfp_mask);
566
567         rq->elevator_private = NULL;
568         return 0;
569 }
570
571 void elv_put_request(request_queue_t *q, struct request *rq)
572 {
573         elevator_t *e = q->elevator;
574
575         if (e->ops->elevator_put_req_fn)
576                 e->ops->elevator_put_req_fn(q, rq);
577 }
578
579 int elv_may_queue(request_queue_t *q, int rw, struct bio *bio)
580 {
581         elevator_t *e = q->elevator;
582
583         if (e->ops->elevator_may_queue_fn)
584                 return e->ops->elevator_may_queue_fn(q, rw, bio);
585
586         return ELV_MQUEUE_MAY;
587 }
588
589 void elv_completed_request(request_queue_t *q, struct request *rq)
590 {
591         elevator_t *e = q->elevator;
592
593         /*
594          * request is released from the driver, io must be done
595          */
596         if (blk_account_rq(rq)) {
597                 q->in_flight--;
598                 if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn)
599                         e->ops->elevator_completed_req_fn(q, rq);
600         }
601 }
602
603 int elv_register_queue(struct request_queue *q)
604 {
605         elevator_t *e = q->elevator;
606
607         e->kobj.parent = kobject_get(&q->kobj);
608         if (!e->kobj.parent)
609                 return -EBUSY;
610
611         snprintf(e->kobj.name, KOBJ_NAME_LEN, "%s", "iosched");
612         e->kobj.ktype = e->elevator_type->elevator_ktype;
613
614         return kobject_register(&e->kobj);
615 }
616
617 void elv_unregister_queue(struct request_queue *q)
618 {
619         if (q) {
620                 elevator_t *e = q->elevator;
621                 kobject_unregister(&e->kobj);
622                 kobject_put(&q->kobj);
623         }
624 }
625
626 int elv_register(struct elevator_type *e)
627 {
628         spin_lock_irq(&elv_list_lock);
629         if (elevator_find(e->elevator_name))
630                 BUG();
631         list_add_tail(&e->list, &elv_list);
632         spin_unlock_irq(&elv_list_lock);
633
634         printk(KERN_INFO "io scheduler %s registered", e->elevator_name);
635         if (!strcmp(e->elevator_name, chosen_elevator))
636                 printk(" (default)");
637         printk("\n");
638         return 0;
639 }
640 EXPORT_SYMBOL_GPL(elv_register);
641
642 void elv_unregister(struct elevator_type *e)
643 {
644         struct task_struct *g, *p;
645
646         /*
647          * Iterate every thread in the process to remove the io contexts.
648          */
649         read_lock(&tasklist_lock);
650         do_each_thread(g, p) {
651                 struct io_context *ioc = p->io_context;
652                 if (ioc && ioc->cic) {
653                         ioc->cic->exit(ioc->cic);
654                         ioc->cic->dtor(ioc->cic);
655                         ioc->cic = NULL;
656                 }
657                 if (ioc && ioc->aic) {
658                         ioc->aic->exit(ioc->aic);
659                         ioc->aic->dtor(ioc->aic);
660                         ioc->aic = NULL;
661                 }
662         } while_each_thread(g, p);
663         read_unlock(&tasklist_lock);
664
665         spin_lock_irq(&elv_list_lock);
666         list_del_init(&e->list);
667         spin_unlock_irq(&elv_list_lock);
668 }
669 EXPORT_SYMBOL_GPL(elv_unregister);
670
671 /*
672  * switch to new_e io scheduler. be careful not to introduce deadlocks -
673  * we don't free the old io scheduler, before we have allocated what we
674  * need for the new one. this way we have a chance of going back to the old
675  * one, if the new one fails init for some reason.
676  */
677 static void elevator_switch(request_queue_t *q, struct elevator_type *new_e)
678 {
679         elevator_t *old_elevator, *e;
680
681         /*
682          * Allocate new elevator
683          */
684         e = kmalloc(sizeof(elevator_t), GFP_KERNEL);
685         if (!e)
686                 goto error;
687
688         /*
689          * Turn on BYPASS and drain all requests w/ elevator private data
690          */
691         spin_lock_irq(q->queue_lock);
692
693         set_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags);
694
695         while (q->elevator->ops->elevator_dispatch_fn(q, 1))
696                 ;
697
698         while (q->rq.elvpriv) {
699                 spin_unlock_irq(q->queue_lock);
700                 msleep(10);
701                 spin_lock_irq(q->queue_lock);
702         }
703
704         spin_unlock_irq(q->queue_lock);
705
706         /*
707          * unregister old elevator data
708          */
709         elv_unregister_queue(q);
710         old_elevator = q->elevator;
711
712         /*
713          * attach and start new elevator
714          */
715         if (elevator_attach(q, new_e, e))
716                 goto fail;
717
718         if (elv_register_queue(q))
719                 goto fail_register;
720
721         /*
722          * finally exit old elevator and turn off BYPASS.
723          */
724         elevator_exit(old_elevator);
725         clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags);
726         return;
727
728 fail_register:
729         /*
730          * switch failed, exit the new io scheduler and reattach the old
731          * one again (along with re-adding the sysfs dir)
732          */
733         elevator_exit(e);
734         e = NULL;
735 fail:
736         q->elevator = old_elevator;
737         elv_register_queue(q);
738         clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags);
739         kfree(e);
740 error:
741         elevator_put(new_e);
742         printk(KERN_ERR "elevator: switch to %s failed\n",new_e->elevator_name);
743 }
744
745 ssize_t elv_iosched_store(request_queue_t *q, const char *name, size_t count)
746 {
747         char elevator_name[ELV_NAME_MAX];
748         struct elevator_type *e;
749
750         memset(elevator_name, 0, sizeof(elevator_name));
751         strncpy(elevator_name, name, sizeof(elevator_name));
752
753         if (elevator_name[strlen(elevator_name) - 1] == '\n')
754                 elevator_name[strlen(elevator_name) - 1] = '\0';
755
756         e = elevator_get(elevator_name);
757         if (!e) {
758                 printk(KERN_ERR "elevator: type %s not found\n", elevator_name);
759                 return -EINVAL;
760         }
761
762         if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) {
763                 elevator_put(e);
764                 return count;
765         }
766
767         elevator_switch(q, e);
768         return count;
769 }
770
771 ssize_t elv_iosched_show(request_queue_t *q, char *name)
772 {
773         elevator_t *e = q->elevator;
774         struct elevator_type *elv = e->elevator_type;
775         struct list_head *entry;
776         int len = 0;
777
778         spin_lock_irq(q->queue_lock);
779         list_for_each(entry, &elv_list) {
780                 struct elevator_type *__e;
781
782                 __e = list_entry(entry, struct elevator_type, list);
783                 if (!strcmp(elv->elevator_name, __e->elevator_name))
784                         len += sprintf(name+len, "[%s] ", elv->elevator_name);
785                 else
786                         len += sprintf(name+len, "%s ", __e->elevator_name);
787         }
788         spin_unlock_irq(q->queue_lock);
789
790         len += sprintf(len+name, "\n");
791         return len;
792 }
793
794 EXPORT_SYMBOL(elv_dispatch_sort);
795 EXPORT_SYMBOL(elv_add_request);
796 EXPORT_SYMBOL(__elv_add_request);
797 EXPORT_SYMBOL(elv_requeue_request);
798 EXPORT_SYMBOL(elv_next_request);
799 EXPORT_SYMBOL(elv_dequeue_request);
800 EXPORT_SYMBOL(elv_queue_empty);
801 EXPORT_SYMBOL(elv_completed_request);
802 EXPORT_SYMBOL(elevator_exit);
803 EXPORT_SYMBOL(elevator_init);