aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/elevator.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/elevator.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/elevator.h')
-rw-r--r--include/linux/elevator.h145
1 files changed, 145 insertions, 0 deletions
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
new file mode 100644
index 000000000000..ee54f81faad5
--- /dev/null
+++ b/include/linux/elevator.h
@@ -0,0 +1,145 @@
1#ifndef _LINUX_ELEVATOR_H
2#define _LINUX_ELEVATOR_H
3
4typedef int (elevator_merge_fn) (request_queue_t *, struct request **,
5 struct bio *);
6
7typedef void (elevator_merge_req_fn) (request_queue_t *, struct request *, struct request *);
8
9typedef void (elevator_merged_fn) (request_queue_t *, struct request *);
10
11typedef struct request *(elevator_next_req_fn) (request_queue_t *);
12
13typedef void (elevator_add_req_fn) (request_queue_t *, struct request *, int);
14typedef int (elevator_queue_empty_fn) (request_queue_t *);
15typedef void (elevator_remove_req_fn) (request_queue_t *, struct request *);
16typedef void (elevator_requeue_req_fn) (request_queue_t *, struct request *);
17typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *);
18typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *);
19typedef int (elevator_may_queue_fn) (request_queue_t *, int);
20
21typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, int);
22typedef void (elevator_put_req_fn) (request_queue_t *, struct request *);
23typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
24
25typedef int (elevator_init_fn) (request_queue_t *, elevator_t *);
26typedef void (elevator_exit_fn) (elevator_t *);
27
28struct elevator_ops
29{
30 elevator_merge_fn *elevator_merge_fn;
31 elevator_merged_fn *elevator_merged_fn;
32 elevator_merge_req_fn *elevator_merge_req_fn;
33
34 elevator_next_req_fn *elevator_next_req_fn;
35 elevator_add_req_fn *elevator_add_req_fn;
36 elevator_remove_req_fn *elevator_remove_req_fn;
37 elevator_requeue_req_fn *elevator_requeue_req_fn;
38 elevator_deactivate_req_fn *elevator_deactivate_req_fn;
39
40 elevator_queue_empty_fn *elevator_queue_empty_fn;
41 elevator_completed_req_fn *elevator_completed_req_fn;
42
43 elevator_request_list_fn *elevator_former_req_fn;
44 elevator_request_list_fn *elevator_latter_req_fn;
45
46 elevator_set_req_fn *elevator_set_req_fn;
47 elevator_put_req_fn *elevator_put_req_fn;
48
49 elevator_may_queue_fn *elevator_may_queue_fn;
50
51 elevator_init_fn *elevator_init_fn;
52 elevator_exit_fn *elevator_exit_fn;
53};
54
55#define ELV_NAME_MAX (16)
56
57/*
58 * identifies an elevator type, such as AS or deadline
59 */
60struct elevator_type
61{
62 struct list_head list;
63 struct elevator_ops ops;
64 struct elevator_type *elevator_type;
65 struct kobj_type *elevator_ktype;
66 char elevator_name[ELV_NAME_MAX];
67 struct module *elevator_owner;
68};
69
70/*
71 * each queue has an elevator_queue assoicated with it
72 */
73struct elevator_queue
74{
75 struct elevator_ops *ops;
76 void *elevator_data;
77 struct kobject kobj;
78 struct elevator_type *elevator_type;
79};
80
81/*
82 * block elevator interface
83 */
84extern void elv_add_request(request_queue_t *, struct request *, int, int);
85extern void __elv_add_request(request_queue_t *, struct request *, int, int);
86extern int elv_merge(request_queue_t *, struct request **, struct bio *);
87extern void elv_merge_requests(request_queue_t *, struct request *,
88 struct request *);
89extern void elv_merged_request(request_queue_t *, struct request *);
90extern void elv_remove_request(request_queue_t *, struct request *);
91extern void elv_requeue_request(request_queue_t *, struct request *);
92extern void elv_deactivate_request(request_queue_t *, struct request *);
93extern int elv_queue_empty(request_queue_t *);
94extern struct request *elv_next_request(struct request_queue *q);
95extern struct request *elv_former_request(request_queue_t *, struct request *);
96extern struct request *elv_latter_request(request_queue_t *, struct request *);
97extern int elv_register_queue(request_queue_t *q);
98extern void elv_unregister_queue(request_queue_t *q);
99extern int elv_may_queue(request_queue_t *, int);
100extern void elv_completed_request(request_queue_t *, struct request *);
101extern int elv_set_request(request_queue_t *, struct request *, int);
102extern void elv_put_request(request_queue_t *, struct request *);
103
104/*
105 * io scheduler registration
106 */
107extern int elv_register(struct elevator_type *);
108extern void elv_unregister(struct elevator_type *);
109
110/*
111 * io scheduler sysfs switching
112 */
113extern ssize_t elv_iosched_show(request_queue_t *, char *);
114extern ssize_t elv_iosched_store(request_queue_t *, const char *, size_t);
115
116extern int elevator_init(request_queue_t *, char *);
117extern void elevator_exit(elevator_t *);
118extern int elv_rq_merge_ok(struct request *, struct bio *);
119extern int elv_try_merge(struct request *, struct bio *);
120extern int elv_try_last_merge(request_queue_t *, struct bio *);
121
122/*
123 * Return values from elevator merger
124 */
125#define ELEVATOR_NO_MERGE 0
126#define ELEVATOR_FRONT_MERGE 1
127#define ELEVATOR_BACK_MERGE 2
128
129/*
130 * Insertion selection
131 */
132#define ELEVATOR_INSERT_FRONT 1
133#define ELEVATOR_INSERT_BACK 2
134#define ELEVATOR_INSERT_SORT 3
135
136/*
137 * return values from elevator_may_queue_fn
138 */
139enum {
140 ELV_MQUEUE_MAY,
141 ELV_MQUEUE_NO,
142 ELV_MQUEUE_MUST,
143};
144
145#endif