Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | #ifndef _LINUX_ELEVATOR_H |
2 | #define _LINUX_ELEVATOR_H |
||
3 | |||
4 | typedef int (elevator_merge_fn) (request_queue_t *, struct request **, |
||
5 | struct bio *); |
||
6 | |||
7 | typedef void (elevator_merge_req_fn) (request_queue_t *, struct request *, struct request *); |
||
8 | |||
9 | typedef void (elevator_merged_fn) (request_queue_t *, struct request *); |
||
10 | |||
11 | typedef struct request *(elevator_next_req_fn) (request_queue_t *); |
||
12 | |||
13 | typedef void (elevator_add_req_fn) (request_queue_t *, struct request *, int); |
||
14 | typedef int (elevator_queue_empty_fn) (request_queue_t *); |
||
15 | typedef void (elevator_remove_req_fn) (request_queue_t *, struct request *); |
||
16 | typedef void (elevator_requeue_req_fn) (request_queue_t *, struct request *); |
||
17 | typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *); |
||
18 | typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *); |
||
19 | typedef int (elevator_may_queue_fn) (request_queue_t *, int); |
||
20 | |||
21 | typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, int); |
||
22 | typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); |
||
23 | |||
24 | typedef int (elevator_init_fn) (request_queue_t *, elevator_t *); |
||
25 | typedef void (elevator_exit_fn) (request_queue_t *, elevator_t *); |
||
26 | |||
27 | struct elevator_s |
||
28 | { |
||
29 | elevator_merge_fn *elevator_merge_fn; |
||
30 | elevator_merged_fn *elevator_merged_fn; |
||
31 | elevator_merge_req_fn *elevator_merge_req_fn; |
||
32 | |||
33 | elevator_next_req_fn *elevator_next_req_fn; |
||
34 | elevator_add_req_fn *elevator_add_req_fn; |
||
35 | elevator_remove_req_fn *elevator_remove_req_fn; |
||
36 | elevator_requeue_req_fn *elevator_requeue_req_fn; |
||
37 | |||
38 | elevator_queue_empty_fn *elevator_queue_empty_fn; |
||
39 | elevator_completed_req_fn *elevator_completed_req_fn; |
||
40 | |||
41 | elevator_request_list_fn *elevator_former_req_fn; |
||
42 | elevator_request_list_fn *elevator_latter_req_fn; |
||
43 | |||
44 | elevator_set_req_fn *elevator_set_req_fn; |
||
45 | elevator_put_req_fn *elevator_put_req_fn; |
||
46 | |||
47 | elevator_may_queue_fn *elevator_may_queue_fn; |
||
48 | |||
49 | elevator_init_fn *elevator_init_fn; |
||
50 | elevator_exit_fn *elevator_exit_fn; |
||
51 | |||
52 | void *elevator_data; |
||
53 | |||
54 | struct kobject kobj; |
||
55 | struct kobj_type *elevator_ktype; |
||
56 | const char *elevator_name; |
||
57 | }; |
||
58 | |||
59 | /* |
||
60 | * block elevator interface |
||
61 | */ |
||
62 | extern void elv_add_request(request_queue_t *, struct request *, int, int); |
||
63 | extern void __elv_add_request(request_queue_t *, struct request *, int, int); |
||
64 | extern int elv_merge(request_queue_t *, struct request **, struct bio *); |
||
65 | extern void elv_merge_requests(request_queue_t *, struct request *, |
||
66 | struct request *); |
||
67 | extern void elv_merged_request(request_queue_t *, struct request *); |
||
68 | extern void elv_remove_request(request_queue_t *, struct request *); |
||
69 | extern void elv_requeue_request(request_queue_t *, struct request *); |
||
70 | extern int elv_queue_empty(request_queue_t *); |
||
71 | extern struct request *elv_next_request(struct request_queue *q); |
||
72 | extern struct request *elv_former_request(request_queue_t *, struct request *); |
||
73 | extern struct request *elv_latter_request(request_queue_t *, struct request *); |
||
74 | extern int elv_register_queue(request_queue_t *q); |
||
75 | extern void elv_unregister_queue(request_queue_t *q); |
||
76 | extern int elv_may_queue(request_queue_t *, int); |
||
77 | extern void elv_completed_request(request_queue_t *, struct request *); |
||
78 | extern int elv_set_request(request_queue_t *, struct request *, int); |
||
79 | extern void elv_put_request(request_queue_t *, struct request *); |
||
80 | |||
81 | /* |
||
82 | * noop I/O scheduler. always merges, always inserts new request at tail |
||
83 | */ |
||
84 | extern elevator_t elevator_noop; |
||
85 | |||
86 | /* |
||
87 | * deadline i/o scheduler. uses request time outs to prevent indefinite |
||
88 | * starvation |
||
89 | */ |
||
90 | extern elevator_t iosched_deadline; |
||
91 | |||
92 | /* |
||
93 | * anticipatory I/O scheduler |
||
94 | */ |
||
95 | extern elevator_t iosched_as; |
||
96 | |||
97 | extern int elevator_init(request_queue_t *, elevator_t *); |
||
98 | extern void elevator_exit(request_queue_t *); |
||
99 | extern inline int elv_rq_merge_ok(struct request *, struct bio *); |
||
100 | extern inline int elv_try_merge(struct request *, struct bio *); |
||
101 | extern inline int elv_try_last_merge(request_queue_t *, struct bio *); |
||
102 | |||
103 | /* |
||
104 | * Return values from elevator merger |
||
105 | */ |
||
106 | #define ELEVATOR_NO_MERGE 0 |
||
107 | #define ELEVATOR_FRONT_MERGE 1 |
||
108 | #define ELEVATOR_BACK_MERGE 2 |
||
109 | |||
110 | /* |
||
111 | * Insertion selection |
||
112 | */ |
||
113 | #define ELEVATOR_INSERT_FRONT 1 |
||
114 | #define ELEVATOR_INSERT_BACK 2 |
||
115 | #define ELEVATOR_INSERT_SORT 3 |
||
116 | |||
117 | #endif |