diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/blkdev.h | 26 | ||||
-rw-r--r-- | include/linux/elevator.h | 18 |
2 files changed, 31 insertions, 13 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 1afbdb2d752c..fffe163316aa 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -203,6 +203,7 @@ struct request { | |||
203 | enum rq_flag_bits { | 203 | enum 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,12 @@ 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 end_sector; | ||
341 | struct request *boundary_rq; | ||
342 | |||
343 | /* | ||
336 | * Auto-unplugging state | 344 | * Auto-unplugging state |
337 | */ | 345 | */ |
338 | struct timer_list unplug_timer; | 346 | struct timer_list unplug_timer; |
@@ -454,6 +462,7 @@ enum { | |||
454 | #define blk_pm_request(rq) \ | 462 | #define blk_pm_request(rq) \ |
455 | ((rq)->flags & (REQ_PM_SUSPEND | REQ_PM_RESUME)) | 463 | ((rq)->flags & (REQ_PM_SUSPEND | REQ_PM_RESUME)) |
456 | 464 | ||
465 | #define blk_sorted_rq(rq) ((rq)->flags & REQ_SORTED) | ||
457 | #define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER) | 466 | #define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER) |
458 | #define blk_barrier_preflush(rq) ((rq)->flags & REQ_BAR_PREFLUSH) | 467 | #define blk_barrier_preflush(rq) ((rq)->flags & REQ_BAR_PREFLUSH) |
459 | #define blk_barrier_postflush(rq) ((rq)->flags & REQ_BAR_POSTFLUSH) | 468 | #define blk_barrier_postflush(rq) ((rq)->flags & REQ_BAR_POSTFLUSH) |
@@ -611,12 +620,21 @@ extern void end_request(struct request *req, int uptodate); | |||
611 | 620 | ||
612 | static inline void blkdev_dequeue_request(struct request *req) | 621 | static inline void blkdev_dequeue_request(struct request *req) |
613 | { | 622 | { |
614 | BUG_ON(list_empty(&req->queuelist)); | 623 | elv_dequeue_request(req->q, req); |
624 | } | ||
615 | 625 | ||
616 | list_del_init(&req->queuelist); | 626 | /* |
627 | * This should be in elevator.h, but that requires pulling in rq and q | ||
628 | */ | ||
629 | static inline void elv_dispatch_add_tail(struct request_queue *q, | ||
630 | struct request *rq) | ||
631 | { | ||
632 | if (q->last_merge == rq) | ||
633 | q->last_merge = NULL; | ||
617 | 634 | ||
618 | if (req->rl) | 635 | q->end_sector = rq_end_sector(rq); |
619 | elv_remove_request(req->q, req); | 636 | q->boundary_rq = rq; |
637 | list_add_tail(&rq->queuelist, &q->queue_head); | ||
620 | } | 638 | } |
621 | 639 | ||
622 | /* | 640 | /* |
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index ed93125c1db5..a74c27e460ba 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 | ||
9 | typedef void (elevator_merged_fn) (request_queue_t *, struct request *); | 9 | typedef void (elevator_merged_fn) (request_queue_t *, struct request *); |
10 | 10 | ||
11 | typedef struct request *(elevator_next_req_fn) (request_queue_t *); | 11 | typedef int (elevator_dispatch_fn) (request_queue_t *, int); |
12 | 12 | ||
13 | typedef void (elevator_add_req_fn) (request_queue_t *, struct request *, int); | 13 | typedef void (elevator_add_req_fn) (request_queue_t *, struct request *); |
14 | typedef int (elevator_queue_empty_fn) (request_queue_t *); | 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 *); | 15 | typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *); |
18 | typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *); | 16 | typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *); |
19 | typedef int (elevator_may_queue_fn) (request_queue_t *, int, struct bio *); | 17 | typedef int (elevator_may_queue_fn) (request_queue_t *, int, struct bio *); |
20 | 18 | ||
21 | typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, struct bio *, gfp_t); | 19 | typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, struct bio *, gfp_t); |
22 | typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); | 20 | typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); |
21 | typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); | ||
23 | typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); | 22 | typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); |
24 | 23 | ||
25 | typedef int (elevator_init_fn) (request_queue_t *, elevator_t *); | 24 | typedef 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 | */ |
82 | extern void elv_dispatch_sort(request_queue_t *, struct request *); | ||
84 | extern void elv_add_request(request_queue_t *, struct request *, int, int); | 83 | extern void elv_add_request(request_queue_t *, struct request *, int, int); |
85 | extern void __elv_add_request(request_queue_t *, struct request *, int, int); | 84 | extern void __elv_add_request(request_queue_t *, struct request *, int, int); |
86 | extern int elv_merge(request_queue_t *, struct request **, struct bio *); | 85 | extern int elv_merge(request_queue_t *, struct request **, struct bio *); |
87 | extern void elv_merge_requests(request_queue_t *, struct request *, | 86 | extern void elv_merge_requests(request_queue_t *, struct request *, |
88 | struct request *); | 87 | struct request *); |
89 | extern void elv_merged_request(request_queue_t *, struct request *); | 88 | extern void elv_merged_request(request_queue_t *, struct request *); |
90 | extern void elv_remove_request(request_queue_t *, struct request *); | 89 | extern void elv_dequeue_request(request_queue_t *, struct request *); |
91 | extern void elv_requeue_request(request_queue_t *, struct request *); | 90 | extern void elv_requeue_request(request_queue_t *, struct request *); |
92 | extern void elv_deactivate_request(request_queue_t *, struct request *); | ||
93 | extern int elv_queue_empty(request_queue_t *); | 91 | extern int elv_queue_empty(request_queue_t *); |
94 | extern struct request *elv_next_request(struct request_queue *q); | 92 | extern struct request *elv_next_request(struct request_queue *q); |
95 | extern struct request *elv_former_request(request_queue_t *, struct request *); | 93 | extern struct request *elv_former_request(request_queue_t *, struct request *); |
@@ -142,4 +140,6 @@ enum { | |||
142 | ELV_MQUEUE_MUST, | 140 | ELV_MQUEUE_MUST, |
143 | }; | 141 | }; |
144 | 142 | ||
143 | #define rq_end_sector(rq) ((rq)->sector + (rq)->nr_sectors) | ||
144 | |||
145 | #endif | 145 | #endif |