aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2005-10-20 10:23:44 -0400
committerJens Axboe <axboe@nelson.home.kernel.dk>2005-10-28 02:44:24 -0400
commit8922e16cf6269e668123acb1ae1fdc62b7a3a4fc (patch)
tree272bff0b53bf6fe4a7787728a45a26a282ba2976 /include/linux
parent2824bc9328467127083c1325f54b67d298c333b2 (diff)
[PATCH] 01/05 Implement generic dispatch queue
Implements generic dispatch queue which can replace all dispatch queues implemented by each iosched. This reduces code duplication, eases enforcing semantics over dispatch queue, and simplifies specific ioscheds. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/blkdev.h17
-rw-r--r--include/linux/elevator.h16
2 files changed, 18 insertions, 15 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index efdc9b5bc05c..2c7b9154927a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -203,6 +203,7 @@ struct request {
203enum rq_flag_bits { 203enum rq_flag_bits {
204 __REQ_RW, /* not set, read. set, write */ 204 __REQ_RW, /* not set, read. set, write */
205 __REQ_FAILFAST, /* no low level driver retries */ 205 __REQ_FAILFAST, /* no low level driver retries */
206 __REQ_SORTED, /* elevator knows about this request */
206 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ 207 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
207 __REQ_HARDBARRIER, /* may not be passed by drive either */ 208 __REQ_HARDBARRIER, /* may not be passed by drive either */
208 __REQ_CMD, /* is a regular fs rw request */ 209 __REQ_CMD, /* is a regular fs rw request */
@@ -235,6 +236,7 @@ enum rq_flag_bits {
235 236
236#define REQ_RW (1 << __REQ_RW) 237#define REQ_RW (1 << __REQ_RW)
237#define REQ_FAILFAST (1 << __REQ_FAILFAST) 238#define REQ_FAILFAST (1 << __REQ_FAILFAST)
239#define REQ_SORTED (1 << __REQ_SORTED)
238#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) 240#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
239#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) 241#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
240#define REQ_CMD (1 << __REQ_CMD) 242#define REQ_CMD (1 << __REQ_CMD)
@@ -333,6 +335,13 @@ struct request_queue
333 end_flush_fn *end_flush_fn; 335 end_flush_fn *end_flush_fn;
334 336
335 /* 337 /*
338 * Dispatch queue sorting
339 */
340 sector_t last_sector;
341 struct request *boundary_rq;
342 unsigned int max_back_kb;
343
344 /*
336 * Auto-unplugging state 345 * Auto-unplugging state
337 */ 346 */
338 struct timer_list unplug_timer; 347 struct timer_list unplug_timer;
@@ -454,6 +463,7 @@ enum {
454#define blk_pm_request(rq) \ 463#define blk_pm_request(rq) \
455 ((rq)->flags & (REQ_PM_SUSPEND | REQ_PM_RESUME)) 464 ((rq)->flags & (REQ_PM_SUSPEND | REQ_PM_RESUME))
456 465
466#define blk_sorted_rq(rq) ((rq)->flags & REQ_SORTED)
457#define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER) 467#define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER)
458#define blk_barrier_preflush(rq) ((rq)->flags & REQ_BAR_PREFLUSH) 468#define blk_barrier_preflush(rq) ((rq)->flags & REQ_BAR_PREFLUSH)
459#define blk_barrier_postflush(rq) ((rq)->flags & REQ_BAR_POSTFLUSH) 469#define blk_barrier_postflush(rq) ((rq)->flags & REQ_BAR_POSTFLUSH)
@@ -611,12 +621,7 @@ extern void end_request(struct request *req, int uptodate);
611 621
612static inline void blkdev_dequeue_request(struct request *req) 622static inline void blkdev_dequeue_request(struct request *req)
613{ 623{
614 BUG_ON(list_empty(&req->queuelist)); 624 elv_dequeue_request(req->q, req);
615
616 list_del_init(&req->queuelist);
617
618 if (req->rl)
619 elv_remove_request(req->q, req);
620} 625}
621 626
622/* 627/*
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index ea6bbc2d7407..76f4f6920744 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -8,18 +8,17 @@ typedef void (elevator_merge_req_fn) (request_queue_t *, struct request *, struc
8 8
9typedef void (elevator_merged_fn) (request_queue_t *, struct request *); 9typedef void (elevator_merged_fn) (request_queue_t *, struct request *);
10 10
11typedef struct request *(elevator_next_req_fn) (request_queue_t *); 11typedef int (elevator_dispatch_fn) (request_queue_t *, int);
12 12
13typedef void (elevator_add_req_fn) (request_queue_t *, struct request *, int); 13typedef void (elevator_add_req_fn) (request_queue_t *, struct request *);
14typedef int (elevator_queue_empty_fn) (request_queue_t *); 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 *); 15typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *);
18typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *); 16typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *);
19typedef int (elevator_may_queue_fn) (request_queue_t *, int, struct bio *); 17typedef int (elevator_may_queue_fn) (request_queue_t *, int, struct bio *);
20 18
21typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, struct bio *, int); 19typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, struct bio *, int);
22typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); 20typedef void (elevator_put_req_fn) (request_queue_t *, struct request *);
21typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *);
23typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); 22typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
24 23
25typedef int (elevator_init_fn) (request_queue_t *, elevator_t *); 24typedef int (elevator_init_fn) (request_queue_t *, elevator_t *);
@@ -31,10 +30,9 @@ struct elevator_ops
31 elevator_merged_fn *elevator_merged_fn; 30 elevator_merged_fn *elevator_merged_fn;
32 elevator_merge_req_fn *elevator_merge_req_fn; 31 elevator_merge_req_fn *elevator_merge_req_fn;
33 32
34 elevator_next_req_fn *elevator_next_req_fn; 33 elevator_dispatch_fn *elevator_dispatch_fn;
35 elevator_add_req_fn *elevator_add_req_fn; 34 elevator_add_req_fn *elevator_add_req_fn;
36 elevator_remove_req_fn *elevator_remove_req_fn; 35 elevator_activate_req_fn *elevator_activate_req_fn;
37 elevator_requeue_req_fn *elevator_requeue_req_fn;
38 elevator_deactivate_req_fn *elevator_deactivate_req_fn; 36 elevator_deactivate_req_fn *elevator_deactivate_req_fn;
39 37
40 elevator_queue_empty_fn *elevator_queue_empty_fn; 38 elevator_queue_empty_fn *elevator_queue_empty_fn;
@@ -81,15 +79,15 @@ struct elevator_queue
81/* 79/*
82 * block elevator interface 80 * block elevator interface
83 */ 81 */
82extern void elv_dispatch_insert(request_queue_t *, struct request *, int);
84extern void elv_add_request(request_queue_t *, struct request *, int, int); 83extern void elv_add_request(request_queue_t *, struct request *, int, int);
85extern void __elv_add_request(request_queue_t *, struct request *, int, int); 84extern void __elv_add_request(request_queue_t *, struct request *, int, int);
86extern int elv_merge(request_queue_t *, struct request **, struct bio *); 85extern int elv_merge(request_queue_t *, struct request **, struct bio *);
87extern void elv_merge_requests(request_queue_t *, struct request *, 86extern void elv_merge_requests(request_queue_t *, struct request *,
88 struct request *); 87 struct request *);
89extern void elv_merged_request(request_queue_t *, struct request *); 88extern void elv_merged_request(request_queue_t *, struct request *);
90extern void elv_remove_request(request_queue_t *, struct request *); 89extern void elv_dequeue_request(request_queue_t *, struct request *);
91extern void elv_requeue_request(request_queue_t *, struct request *); 90extern 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 *); 91extern int elv_queue_empty(request_queue_t *);
94extern struct request *elv_next_request(struct request_queue *q); 92extern struct request *elv_next_request(struct request_queue *q);
95extern struct request *elv_former_request(request_queue_t *, struct request *); 93extern struct request *elv_former_request(request_queue_t *, struct request *);