4 #include <linux/blkdev.h>
5 #include <linux/elevator.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,
18 ret = elv_try_last_merge(q, bio);
19 if (ret != ELEVATOR_NO_MERGE)
25 static void elevator_noop_merge_requests(request_queue_t *q, struct request *req,
28 list_del_init(&next->queuelist);
31 static void elevator_noop_add_request(request_queue_t *q, struct request *rq,
34 if (where == ELEVATOR_INSERT_FRONT)
35 list_add(&rq->queuelist, &q->queue_head);
37 list_add_tail(&rq->queuelist, &q->queue_head);
40 * new merges must not precede this barrier
42 if (rq->flags & REQ_HARDBARRIER)
44 else if (!q->last_merge)
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);
56 static struct elevator_type elevator_noop = {
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");