[PATCH] ioc4_serial: Remove bogus error message
[linux-2.6] / drivers / block / noop-iosched.c
1 /*
2  * elevator noop
3  */
4 #include <linux/blkdev.h>
5 #include <linux/elevator.h>
6 #include <linux/bio.h>
7 #include <linux/module.h>
8 #include <linux/init.h>
9
10 /*
11  * See if we can find a request that this buffer can be coalesced with.
12  */
13 static 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
25 static 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
31 static void elevator_noop_add_request(request_queue_t *q, struct request *rq,
32                                       int where)
33 {
34         if (where == ELEVATOR_INSERT_FRONT)
35                 list_add(&rq->queuelist, &q->queue_head);
36         else
37                 list_add_tail(&rq->queuelist, &q->queue_head);
38
39         /*
40          * new merges must not precede this barrier
41          */
42         if (rq->flags & REQ_HARDBARRIER)
43                 q->last_merge = NULL;
44         else if (!q->last_merge)
45                 q->last_merge = rq;
46 }
47
48 static struct request *elevator_noop_next_request(request_queue_t *q)
49 {
50         if (!list_empty(&q->queue_head))
51                 return list_entry_rq(q->queue_head.next);
52
53         return NULL;
54 }
55
56 static struct elevator_type elevator_noop = {
57         .ops = {
58                 .elevator_merge_fn              = elevator_noop_merge,
59                 .elevator_merge_req_fn          = elevator_noop_merge_requests,
60                 .elevator_next_req_fn           = elevator_noop_next_request,
61                 .elevator_add_req_fn            = elevator_noop_add_request,
62         },
63         .elevator_name = "noop",
64         .elevator_owner = THIS_MODULE,
65 };
66
67 static int __init noop_init(void)
68 {
69         return elv_register(&elevator_noop);
70 }
71
72 static void __exit noop_exit(void)
73 {
74         elv_unregister(&elevator_noop);
75 }
76
77 module_init(noop_init);
78 module_exit(noop_exit);
79
80
81 MODULE_AUTHOR("Jens Axboe");
82 MODULE_LICENSE("GPL");
83 MODULE_DESCRIPTION("No-op IO scheduler");