diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/cfq-iosched.c | 83 |
1 files changed, 46 insertions, 37 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index f28d1fb30608..ca198e61fa65 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -15,11 +15,13 @@ | |||
15 | /* | 15 | /* |
16 | * tunables | 16 | * tunables |
17 | */ | 17 | */ |
18 | static const int cfq_quantum = 4; /* max queue in one round of service */ | 18 | /* max queue in one round of service */ |
19 | static const int cfq_quantum = 4; | ||
19 | static const int cfq_fifo_expire[2] = { HZ / 4, HZ / 8 }; | 20 | static const int cfq_fifo_expire[2] = { HZ / 4, HZ / 8 }; |
20 | static const int cfq_back_max = 16 * 1024; /* maximum backwards seek, in KiB */ | 21 | /* maximum backwards seek, in KiB */ |
21 | static const int cfq_back_penalty = 2; /* penalty of a backwards seek */ | 22 | static const int cfq_back_max = 16 * 1024; |
22 | 23 | /* penalty of a backwards seek */ | |
24 | static const int cfq_back_penalty = 2; | ||
23 | static const int cfq_slice_sync = HZ / 10; | 25 | static const int cfq_slice_sync = HZ / 10; |
24 | static int cfq_slice_async = HZ / 25; | 26 | static int cfq_slice_async = HZ / 25; |
25 | static const int cfq_slice_async_rq = 2; | 27 | static const int cfq_slice_async_rq = 2; |
@@ -37,7 +39,8 @@ static int cfq_slice_idle = HZ / 125; | |||
37 | 39 | ||
38 | #define CFQ_SLICE_SCALE (5) | 40 | #define CFQ_SLICE_SCALE (5) |
39 | 41 | ||
40 | #define RQ_CIC(rq) ((struct cfq_io_context*)(rq)->elevator_private) | 42 | #define RQ_CIC(rq) \ |
43 | ((struct cfq_io_context *) (rq)->elevator_private) | ||
41 | #define RQ_CFQQ(rq) ((rq)->elevator_private2) | 44 | #define RQ_CFQQ(rq) ((rq)->elevator_private2) |
42 | 45 | ||
43 | static struct kmem_cache *cfq_pool; | 46 | static struct kmem_cache *cfq_pool; |
@@ -171,15 +174,15 @@ enum cfqq_state_flags { | |||
171 | #define CFQ_CFQQ_FNS(name) \ | 174 | #define CFQ_CFQQ_FNS(name) \ |
172 | static inline void cfq_mark_cfqq_##name(struct cfq_queue *cfqq) \ | 175 | static inline void cfq_mark_cfqq_##name(struct cfq_queue *cfqq) \ |
173 | { \ | 176 | { \ |
174 | cfqq->flags |= (1 << CFQ_CFQQ_FLAG_##name); \ | 177 | (cfqq)->flags |= (1 << CFQ_CFQQ_FLAG_##name); \ |
175 | } \ | 178 | } \ |
176 | static inline void cfq_clear_cfqq_##name(struct cfq_queue *cfqq) \ | 179 | static inline void cfq_clear_cfqq_##name(struct cfq_queue *cfqq) \ |
177 | { \ | 180 | { \ |
178 | cfqq->flags &= ~(1 << CFQ_CFQQ_FLAG_##name); \ | 181 | (cfqq)->flags &= ~(1 << CFQ_CFQQ_FLAG_##name); \ |
179 | } \ | 182 | } \ |
180 | static inline int cfq_cfqq_##name(const struct cfq_queue *cfqq) \ | 183 | static inline int cfq_cfqq_##name(const struct cfq_queue *cfqq) \ |
181 | { \ | 184 | { \ |
182 | return (cfqq->flags & (1 << CFQ_CFQQ_FLAG_##name)) != 0; \ | 185 | return ((cfqq)->flags & (1 << CFQ_CFQQ_FLAG_##name)) != 0; \ |
183 | } | 186 | } |
184 | 187 | ||
185 | CFQ_CFQQ_FNS(on_rr); | 188 | CFQ_CFQQ_FNS(on_rr); |
@@ -1005,7 +1008,8 @@ __cfq_dispatch_requests(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1005 | /* | 1008 | /* |
1006 | * follow expired path, else get first next available | 1009 | * follow expired path, else get first next available |
1007 | */ | 1010 | */ |
1008 | if ((rq = cfq_check_fifo(cfqq)) == NULL) | 1011 | rq = cfq_check_fifo(cfqq); |
1012 | if (rq == NULL) | ||
1009 | rq = cfqq->next_rq; | 1013 | rq = cfqq->next_rq; |
1010 | 1014 | ||
1011 | /* | 1015 | /* |
@@ -1294,28 +1298,28 @@ static void cfq_init_prio_data(struct cfq_queue *cfqq, struct io_context *ioc) | |||
1294 | 1298 | ||
1295 | ioprio_class = IOPRIO_PRIO_CLASS(ioc->ioprio); | 1299 | ioprio_class = IOPRIO_PRIO_CLASS(ioc->ioprio); |
1296 | switch (ioprio_class) { | 1300 | switch (ioprio_class) { |
1297 | default: | 1301 | default: |
1298 | printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class); | 1302 | printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class); |
1299 | case IOPRIO_CLASS_NONE: | 1303 | case IOPRIO_CLASS_NONE: |
1300 | /* | 1304 | /* |
1301 | * no prio set, place us in the middle of the BE classes | 1305 | * no prio set, place us in the middle of the BE classes |
1302 | */ | 1306 | */ |
1303 | cfqq->ioprio = task_nice_ioprio(tsk); | 1307 | cfqq->ioprio = task_nice_ioprio(tsk); |
1304 | cfqq->ioprio_class = IOPRIO_CLASS_BE; | 1308 | cfqq->ioprio_class = IOPRIO_CLASS_BE; |
1305 | break; | 1309 | break; |
1306 | case IOPRIO_CLASS_RT: | 1310 | case IOPRIO_CLASS_RT: |
1307 | cfqq->ioprio = task_ioprio(ioc); | 1311 | cfqq->ioprio = task_ioprio(ioc); |
1308 | cfqq->ioprio_class = IOPRIO_CLASS_RT; | 1312 | cfqq->ioprio_class = IOPRIO_CLASS_RT; |
1309 | break; | 1313 | break; |
1310 | case IOPRIO_CLASS_BE: | 1314 | case IOPRIO_CLASS_BE: |
1311 | cfqq->ioprio = task_ioprio(ioc); | 1315 | cfqq->ioprio = task_ioprio(ioc); |
1312 | cfqq->ioprio_class = IOPRIO_CLASS_BE; | 1316 | cfqq->ioprio_class = IOPRIO_CLASS_BE; |
1313 | break; | 1317 | break; |
1314 | case IOPRIO_CLASS_IDLE: | 1318 | case IOPRIO_CLASS_IDLE: |
1315 | cfqq->ioprio_class = IOPRIO_CLASS_IDLE; | 1319 | cfqq->ioprio_class = IOPRIO_CLASS_IDLE; |
1316 | cfqq->ioprio = 7; | 1320 | cfqq->ioprio = 7; |
1317 | cfq_clear_cfqq_idle_window(cfqq); | 1321 | cfq_clear_cfqq_idle_window(cfqq); |
1318 | break; | 1322 | break; |
1319 | } | 1323 | } |
1320 | 1324 | ||
1321 | /* | 1325 | /* |
@@ -1427,7 +1431,7 @@ out: | |||
1427 | static struct cfq_queue ** | 1431 | static struct cfq_queue ** |
1428 | cfq_async_queue_prio(struct cfq_data *cfqd, int ioprio_class, int ioprio) | 1432 | cfq_async_queue_prio(struct cfq_data *cfqd, int ioprio_class, int ioprio) |
1429 | { | 1433 | { |
1430 | switch(ioprio_class) { | 1434 | switch (ioprio_class) { |
1431 | case IOPRIO_CLASS_RT: | 1435 | case IOPRIO_CLASS_RT: |
1432 | return &cfqd->async_cfqq[0][ioprio]; | 1436 | return &cfqd->async_cfqq[0][ioprio]; |
1433 | case IOPRIO_CLASS_BE: | 1437 | case IOPRIO_CLASS_BE: |
@@ -2018,7 +2022,8 @@ static void cfq_idle_slice_timer(unsigned long data) | |||
2018 | 2022 | ||
2019 | spin_lock_irqsave(cfqd->queue->queue_lock, flags); | 2023 | spin_lock_irqsave(cfqd->queue->queue_lock, flags); |
2020 | 2024 | ||
2021 | if ((cfqq = cfqd->active_queue) != NULL) { | 2025 | cfqq = cfqd->active_queue; |
2026 | if (cfqq) { | ||
2022 | timed_out = 0; | 2027 | timed_out = 0; |
2023 | 2028 | ||
2024 | /* | 2029 | /* |
@@ -2212,14 +2217,18 @@ static ssize_t __FUNC(elevator_t *e, const char *page, size_t count) \ | |||
2212 | return ret; \ | 2217 | return ret; \ |
2213 | } | 2218 | } |
2214 | STORE_FUNCTION(cfq_quantum_store, &cfqd->cfq_quantum, 1, UINT_MAX, 0); | 2219 | STORE_FUNCTION(cfq_quantum_store, &cfqd->cfq_quantum, 1, UINT_MAX, 0); |
2215 | STORE_FUNCTION(cfq_fifo_expire_sync_store, &cfqd->cfq_fifo_expire[1], 1, UINT_MAX, 1); | 2220 | STORE_FUNCTION(cfq_fifo_expire_sync_store, &cfqd->cfq_fifo_expire[1], 1, |
2216 | STORE_FUNCTION(cfq_fifo_expire_async_store, &cfqd->cfq_fifo_expire[0], 1, UINT_MAX, 1); | 2221 | UINT_MAX, 1); |
2222 | STORE_FUNCTION(cfq_fifo_expire_async_store, &cfqd->cfq_fifo_expire[0], 1, | ||
2223 | UINT_MAX, 1); | ||
2217 | STORE_FUNCTION(cfq_back_seek_max_store, &cfqd->cfq_back_max, 0, UINT_MAX, 0); | 2224 | STORE_FUNCTION(cfq_back_seek_max_store, &cfqd->cfq_back_max, 0, UINT_MAX, 0); |
2218 | STORE_FUNCTION(cfq_back_seek_penalty_store, &cfqd->cfq_back_penalty, 1, UINT_MAX, 0); | 2225 | STORE_FUNCTION(cfq_back_seek_penalty_store, &cfqd->cfq_back_penalty, 1, |
2226 | UINT_MAX, 0); | ||
2219 | STORE_FUNCTION(cfq_slice_idle_store, &cfqd->cfq_slice_idle, 0, UINT_MAX, 1); | 2227 | STORE_FUNCTION(cfq_slice_idle_store, &cfqd->cfq_slice_idle, 0, UINT_MAX, 1); |
2220 | STORE_FUNCTION(cfq_slice_sync_store, &cfqd->cfq_slice[1], 1, UINT_MAX, 1); | 2228 | STORE_FUNCTION(cfq_slice_sync_store, &cfqd->cfq_slice[1], 1, UINT_MAX, 1); |
2221 | STORE_FUNCTION(cfq_slice_async_store, &cfqd->cfq_slice[0], 1, UINT_MAX, 1); | 2229 | STORE_FUNCTION(cfq_slice_async_store, &cfqd->cfq_slice[0], 1, UINT_MAX, 1); |
2222 | STORE_FUNCTION(cfq_slice_async_rq_store, &cfqd->cfq_slice_async_rq, 1, UINT_MAX, 0); | 2230 | STORE_FUNCTION(cfq_slice_async_rq_store, &cfqd->cfq_slice_async_rq, 1, |
2231 | UINT_MAX, 0); | ||
2223 | #undef STORE_FUNCTION | 2232 | #undef STORE_FUNCTION |
2224 | 2233 | ||
2225 | #define CFQ_ATTR(name) \ | 2234 | #define CFQ_ATTR(name) \ |