1 #ifndef _LINUX_ELEVATOR_H
2 #define _LINUX_ELEVATOR_H
4 typedef int (elevator_merge_fn
) (request_queue_t
*, struct request
**,
7 typedef void (elevator_merge_req_fn
) (request_queue_t
*, struct request
*, struct request
*);
9 typedef void (elevator_merged_fn
) (request_queue_t
*, struct request
*);
11 typedef struct request
*(elevator_next_req_fn
) (request_queue_t
*);
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);
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
*);
24 typedef int (elevator_init_fn
) (request_queue_t
*, elevator_t
*);
25 typedef void (elevator_exit_fn
) (request_queue_t
*, elevator_t
*);
29 elevator_merge_fn
*elevator_merge_fn
;
30 elevator_merged_fn
*elevator_merged_fn
;
31 elevator_merge_req_fn
*elevator_merge_req_fn
;
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
;
38 elevator_queue_empty_fn
*elevator_queue_empty_fn
;
39 elevator_completed_req_fn
*elevator_completed_req_fn
;
41 elevator_request_list_fn
*elevator_former_req_fn
;
42 elevator_request_list_fn
*elevator_latter_req_fn
;
44 elevator_set_req_fn
*elevator_set_req_fn
;
45 elevator_put_req_fn
*elevator_put_req_fn
;
47 elevator_may_queue_fn
*elevator_may_queue_fn
;
49 elevator_init_fn
*elevator_init_fn
;
50 elevator_exit_fn
*elevator_exit_fn
;
55 struct kobj_type
*elevator_ktype
;
56 const char *elevator_name
;
60 * block elevator interface
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
*,
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
*);
82 * noop I/O scheduler. always merges, always inserts new request at tail
84 extern elevator_t elevator_noop
;
87 * deadline i/o scheduler. uses request time outs to prevent indefinite
90 extern elevator_t iosched_deadline
;
93 * anticipatory I/O scheduler
95 extern elevator_t iosched_as
;
98 * completely fair queueing I/O scheduler
100 extern elevator_t iosched_cfq
;
102 extern int elevator_init(request_queue_t
*, elevator_t
*);
103 extern void elevator_exit(request_queue_t
*);
104 extern int elv_rq_merge_ok(struct request
*, struct bio
*);
105 extern int elv_try_merge(struct request
*, struct bio
*);
106 extern int elv_try_last_merge(request_queue_t
*, struct bio
*);
109 * Return values from elevator merger
111 #define ELEVATOR_NO_MERGE 0
112 #define ELEVATOR_FRONT_MERGE 1
113 #define ELEVATOR_BACK_MERGE 2
116 * Insertion selection
118 #define ELEVATOR_INSERT_FRONT 1
119 #define ELEVATOR_INSERT_BACK 2
120 #define ELEVATOR_INSERT_SORT 3