diff options
Diffstat (limited to 'block/blk.h')
-rw-r--r-- | block/blk.h | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/block/blk.h b/block/blk.h index 79c85f7c9ff5..3fae6add5430 100644 --- a/block/blk.h +++ b/block/blk.h | |||
@@ -13,6 +13,9 @@ extern struct kobj_type blk_queue_ktype; | |||
13 | void init_request_from_bio(struct request *req, struct bio *bio); | 13 | void init_request_from_bio(struct request *req, struct bio *bio); |
14 | void blk_rq_bio_prep(struct request_queue *q, struct request *rq, | 14 | void blk_rq_bio_prep(struct request_queue *q, struct request *rq, |
15 | struct bio *bio); | 15 | struct bio *bio); |
16 | int blk_rq_append_bio(struct request_queue *q, struct request *rq, | ||
17 | struct bio *bio); | ||
18 | void blk_dequeue_request(struct request *rq); | ||
16 | void __blk_queue_free_tags(struct request_queue *q); | 19 | void __blk_queue_free_tags(struct request_queue *q); |
17 | 20 | ||
18 | void blk_unplug_work(struct work_struct *work); | 21 | void blk_unplug_work(struct work_struct *work); |
@@ -43,6 +46,43 @@ static inline void blk_clear_rq_complete(struct request *rq) | |||
43 | clear_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags); | 46 | clear_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags); |
44 | } | 47 | } |
45 | 48 | ||
49 | /* | ||
50 | * Internal elevator interface | ||
51 | */ | ||
52 | #define ELV_ON_HASH(rq) (!hlist_unhashed(&(rq)->hash)) | ||
53 | |||
54 | static inline struct request *__elv_next_request(struct request_queue *q) | ||
55 | { | ||
56 | struct request *rq; | ||
57 | |||
58 | while (1) { | ||
59 | while (!list_empty(&q->queue_head)) { | ||
60 | rq = list_entry_rq(q->queue_head.next); | ||
61 | if (blk_do_ordered(q, &rq)) | ||
62 | return rq; | ||
63 | } | ||
64 | |||
65 | if (!q->elevator->ops->elevator_dispatch_fn(q, 0)) | ||
66 | return NULL; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | static inline void elv_activate_rq(struct request_queue *q, struct request *rq) | ||
71 | { | ||
72 | struct elevator_queue *e = q->elevator; | ||
73 | |||
74 | if (e->ops->elevator_activate_req_fn) | ||
75 | e->ops->elevator_activate_req_fn(q, rq); | ||
76 | } | ||
77 | |||
78 | static inline void elv_deactivate_rq(struct request_queue *q, struct request *rq) | ||
79 | { | ||
80 | struct elevator_queue *e = q->elevator; | ||
81 | |||
82 | if (e->ops->elevator_deactivate_req_fn) | ||
83 | e->ops->elevator_deactivate_req_fn(q, rq); | ||
84 | } | ||
85 | |||
46 | #ifdef CONFIG_FAIL_IO_TIMEOUT | 86 | #ifdef CONFIG_FAIL_IO_TIMEOUT |
47 | int blk_should_fake_timeout(struct request_queue *); | 87 | int blk_should_fake_timeout(struct request_queue *); |
48 | ssize_t part_timeout_show(struct device *, struct device_attribute *, char *); | 88 | ssize_t part_timeout_show(struct device *, struct device_attribute *, char *); |
@@ -64,7 +104,6 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req, | |||
64 | int attempt_back_merge(struct request_queue *q, struct request *rq); | 104 | int attempt_back_merge(struct request_queue *q, struct request *rq); |
65 | int attempt_front_merge(struct request_queue *q, struct request *rq); | 105 | int attempt_front_merge(struct request_queue *q, struct request *rq); |
66 | void blk_recalc_rq_segments(struct request *rq); | 106 | void blk_recalc_rq_segments(struct request *rq); |
67 | void blk_recalc_rq_sectors(struct request *rq, int nsect); | ||
68 | 107 | ||
69 | void blk_queue_congestion_threshold(struct request_queue *q); | 108 | void blk_queue_congestion_threshold(struct request_queue *q); |
70 | 109 | ||
@@ -112,9 +151,17 @@ static inline int blk_cpu_to_group(int cpu) | |||
112 | #endif | 151 | #endif |
113 | } | 152 | } |
114 | 153 | ||
154 | /* | ||
155 | * Contribute to IO statistics IFF: | ||
156 | * | ||
157 | * a) it's attached to a gendisk, and | ||
158 | * b) the queue had IO stats enabled when this request was started, and | ||
159 | * c) it's a file system request or a discard request | ||
160 | */ | ||
115 | static inline int blk_do_io_stat(struct request *rq) | 161 | static inline int blk_do_io_stat(struct request *rq) |
116 | { | 162 | { |
117 | return rq->rq_disk && blk_rq_io_stat(rq); | 163 | return rq->rq_disk && blk_rq_io_stat(rq) && |
164 | (blk_fs_request(rq) || blk_discard_rq(rq)); | ||
118 | } | 165 | } |
119 | 166 | ||
120 | #endif | 167 | #endif |