Root/
Source at commit 6c17a31f1fc515425221067cb3ece599c09dbc5d created 12 years 8 months ago. By Werner Almesberger, atusb, atben: moved from spi/ to ieee802154/; renamed atusb to spi_atusb | |
---|---|
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/slab.h> |
9 | #include <linux/init.h> |
10 | |
11 | struct noop_data { |
12 | struct list_head queue; |
13 | }; |
14 | |
15 | static void noop_merged_requests(struct request_queue *q, struct request *rq, |
16 | struct request *next) |
17 | { |
18 | list_del_init(&next->queuelist); |
19 | } |
20 | |
21 | static int noop_dispatch(struct request_queue *q, int force) |
22 | { |
23 | struct noop_data *nd = q->elevator->elevator_data; |
24 | |
25 | if (!list_empty(&nd->queue)) { |
26 | struct request *rq; |
27 | rq = list_entry(nd->queue.next, struct request, queuelist); |
28 | list_del_init(&rq->queuelist); |
29 | elv_dispatch_sort(q, rq); |
30 | return 1; |
31 | } |
32 | return 0; |
33 | } |
34 | |
35 | static void noop_add_request(struct request_queue *q, struct request *rq) |
36 | { |
37 | struct noop_data *nd = q->elevator->elevator_data; |
38 | |
39 | list_add_tail(&rq->queuelist, &nd->queue); |
40 | } |
41 | |
42 | static int noop_queue_empty(struct request_queue *q) |
43 | { |
44 | struct noop_data *nd = q->elevator->elevator_data; |
45 | |
46 | return list_empty(&nd->queue); |
47 | } |
48 | |
49 | static struct request * |
50 | noop_former_request(struct request_queue *q, struct request *rq) |
51 | { |
52 | struct noop_data *nd = q->elevator->elevator_data; |
53 | |
54 | if (rq->queuelist.prev == &nd->queue) |
55 | return NULL; |
56 | return list_entry(rq->queuelist.prev, struct request, queuelist); |
57 | } |
58 | |
59 | static struct request * |
60 | noop_latter_request(struct request_queue *q, struct request *rq) |
61 | { |
62 | struct noop_data *nd = q->elevator->elevator_data; |
63 | |
64 | if (rq->queuelist.next == &nd->queue) |
65 | return NULL; |
66 | return list_entry(rq->queuelist.next, struct request, queuelist); |
67 | } |
68 | |
69 | static void *noop_init_queue(struct request_queue *q) |
70 | { |
71 | struct noop_data *nd; |
72 | |
73 | nd = kmalloc_node(sizeof(*nd), GFP_KERNEL, q->node); |
74 | if (!nd) |
75 | return NULL; |
76 | INIT_LIST_HEAD(&nd->queue); |
77 | return nd; |
78 | } |
79 | |
80 | static void noop_exit_queue(struct elevator_queue *e) |
81 | { |
82 | struct noop_data *nd = e->elevator_data; |
83 | |
84 | BUG_ON(!list_empty(&nd->queue)); |
85 | kfree(nd); |
86 | } |
87 | |
88 | static struct elevator_type elevator_noop = { |
89 | .ops = { |
90 | .elevator_merge_req_fn = noop_merged_requests, |
91 | .elevator_dispatch_fn = noop_dispatch, |
92 | .elevator_add_req_fn = noop_add_request, |
93 | .elevator_queue_empty_fn = noop_queue_empty, |
94 | .elevator_former_req_fn = noop_former_request, |
95 | .elevator_latter_req_fn = noop_latter_request, |
96 | .elevator_init_fn = noop_init_queue, |
97 | .elevator_exit_fn = noop_exit_queue, |
98 | }, |
99 | .elevator_name = "noop", |
100 | .elevator_owner = THIS_MODULE, |
101 | }; |
102 | |
103 | static int __init noop_init(void) |
104 | { |
105 | elv_register(&elevator_noop); |
106 | |
107 | return 0; |
108 | } |
109 | |
110 | static void __exit noop_exit(void) |
111 | { |
112 | elv_unregister(&elevator_noop); |
113 | } |
114 | |
115 | module_init(noop_init); |
116 | module_exit(noop_exit); |
117 | |
118 | |
119 | MODULE_AUTHOR("Jens Axboe"); |
120 | MODULE_LICENSE("GPL"); |
121 | MODULE_DESCRIPTION("No-op IO scheduler"); |
122 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9