aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-04-22 22:05:18 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-04-28 01:37:34 -0400
commit158dbda0068e63c7cce7bd47c123bd1dfa5a902c (patch)
tree2665f31350ba4f0875c7611c980b0831c22d8c98 /block/blk.h
parent5efccd17ceb0fc43837a331297c2c407969d7201 (diff)
block: reorganize request fetching functions
Impact: code reorganization elv_next_request() and elv_dequeue_request() are public block layer interface than actual elevator implementation. They mostly deal with how requests interact with block layer and low level drivers at the beginning of rqeuest processing whereas __elv_next_request() is the actual eleveator request fetching interface. Move the two functions to blk-core.c. This prepares for further interface cleanup. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'block/blk.h')
-rw-r--r--block/blk.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/block/blk.h b/block/blk.h
index 79c85f7c9ff5..9b2c324e4407 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -43,6 +43,43 @@ static inline void blk_clear_rq_complete(struct request *rq)
43 clear_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags); 43 clear_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags);
44} 44}
45 45
46/*
47 * Internal elevator interface
48 */
49#define ELV_ON_HASH(rq) (!hlist_unhashed(&(rq)->hash))
50
51static inline struct request *__elv_next_request(struct request_queue *q)
52{
53 struct request *rq;
54
55 while (1) {
56 while (!list_empty(&q->queue_head)) {
57 rq = list_entry_rq(q->queue_head.next);
58 if (blk_do_ordered(q, &rq))
59 return rq;
60 }
61
62 if (!q->elevator->ops->elevator_dispatch_fn(q, 0))
63 return NULL;
64 }
65}
66
67static inline void elv_activate_rq(struct request_queue *q, struct request *rq)
68{
69 struct elevator_queue *e = q->elevator;
70
71 if (e->ops->elevator_activate_req_fn)
72 e->ops->elevator_activate_req_fn(q, rq);
73}
74
75static inline void elv_deactivate_rq(struct request_queue *q, struct request *rq)
76{
77 struct elevator_queue *e = q->elevator;
78
79 if (e->ops->elevator_deactivate_req_fn)
80 e->ops->elevator_deactivate_req_fn(q, rq);
81}
82
46#ifdef CONFIG_FAIL_IO_TIMEOUT 83#ifdef CONFIG_FAIL_IO_TIMEOUT
47int blk_should_fake_timeout(struct request_queue *); 84int blk_should_fake_timeout(struct request_queue *);
48ssize_t part_timeout_show(struct device *, struct device_attribute *, char *); 85ssize_t part_timeout_show(struct device *, struct device_attribute *, char *);