[PATCH] aic7xxx_osm build fix
[cris-mirror.git] / drivers / block / noop-iosched.c
blobb1730b62c37e4793a2401df975680c1231903d16
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>
11 * See if we can find a request that this buffer can be coalesced with.
13 static int elevator_noop_merge(request_queue_t *q, struct request **req,
14 struct bio *bio)
16 int ret;
18 ret = elv_try_last_merge(q, bio);
19 if (ret != ELEVATOR_NO_MERGE)
20 *req = q->last_merge;
22 return ret;
25 static void elevator_noop_merge_requests(request_queue_t *q, struct request *req,
26 struct request *next)
28 list_del_init(&next->queuelist);
31 static void elevator_noop_add_request(request_queue_t *q, struct request *rq,
32 int where)
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);
40 * new merges must not precede this barrier
42 if (rq->flags & REQ_HARDBARRIER)
43 q->last_merge = NULL;
44 else if (!q->last_merge)
45 q->last_merge = rq;
48 static struct request *elevator_noop_next_request(request_queue_t *q)
50 if (!list_empty(&q->queue_head))
51 return list_entry_rq(q->queue_head.next);
53 return NULL;
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,
63 .elevator_name = "noop",
64 .elevator_owner = THIS_MODULE,
67 static int __init noop_init(void)
69 return elv_register(&elevator_noop);
72 static void __exit noop_exit(void)
74 elv_unregister(&elevator_noop);
77 module_init(noop_init);
78 module_exit(noop_exit);
81 MODULE_AUTHOR("Jens Axboe");
82 MODULE_LICENSE("GPL");
83 MODULE_DESCRIPTION("No-op IO scheduler");