aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-03-18 13:25:24 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2006-03-18 18:33:59 -0500
commit478a82b0edeea1cc82a5f79880b3a15923a678de (patch)
tree091c2ace634975c62c8236f209b24e4fded81ff4 /block/cfq-iosched.c
parent7670876d2d194b2aecb54f397704838eee7d72ee (diff)
[PATCH] switch to use of ->key to get cfq_data by cfq_io_context
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 63ed11f8795d..42f990f2763d 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1212,7 +1212,7 @@ static void cfq_free_io_context(struct cfq_io_context *cic)
1212 */ 1212 */
1213static void cfq_exit_single_io_context(struct cfq_io_context *cic) 1213static void cfq_exit_single_io_context(struct cfq_io_context *cic)
1214{ 1214{
1215 struct cfq_data *cfqd = cic->cfqq->cfqd; 1215 struct cfq_data *cfqd = cic->key;
1216 request_queue_t *q = cfqd->queue; 1216 request_queue_t *q = cfqd->queue;
1217 1217
1218 WARN_ON(!irqs_disabled()); 1218 WARN_ON(!irqs_disabled());
@@ -1224,6 +1224,7 @@ static void cfq_exit_single_io_context(struct cfq_io_context *cic)
1224 1224
1225 cfq_put_queue(cic->cfqq); 1225 cfq_put_queue(cic->cfqq);
1226 cic->cfqq = NULL; 1226 cic->cfqq = NULL;
1227 cic->key = NULL;
1227 spin_unlock(q->queue_lock); 1228 spin_unlock(q->queue_lock);
1228} 1229}
1229 1230
@@ -1318,14 +1319,17 @@ static void cfq_init_prio_data(struct cfq_queue *cfqq)
1318 cfq_clear_cfqq_prio_changed(cfqq); 1319 cfq_clear_cfqq_prio_changed(cfqq);
1319} 1320}
1320 1321
1321static inline void changed_ioprio(struct cfq_queue *cfqq) 1322static inline void changed_ioprio(struct cfq_io_context *cic)
1322{ 1323{
1323 if (cfqq) { 1324 struct cfq_data *cfqd = cic->key;
1324 struct cfq_data *cfqd = cfqq->cfqd; 1325 struct cfq_queue *cfqq;
1325 1326 if (cfqd) {
1326 spin_lock(cfqd->queue->queue_lock); 1327 spin_lock(cfqd->queue->queue_lock);
1327 cfq_mark_cfqq_prio_changed(cfqq); 1328 cfqq = cic->cfqq;
1328 cfq_init_prio_data(cfqq); 1329 if (cfqq) {
1330 cfq_mark_cfqq_prio_changed(cfqq);
1331 cfq_init_prio_data(cfqq);
1332 }
1329 spin_unlock(cfqd->queue->queue_lock); 1333 spin_unlock(cfqd->queue->queue_lock);
1330 } 1334 }
1331} 1335}
@@ -1337,10 +1341,10 @@ static int cfq_ioc_set_ioprio(struct io_context *ioc, unsigned int ioprio)
1337{ 1341{
1338 struct cfq_io_context *cic = ioc->cic; 1342 struct cfq_io_context *cic = ioc->cic;
1339 1343
1340 changed_ioprio(cic->cfqq); 1344 changed_ioprio(cic);
1341 1345
1342 list_for_each_entry(cic, &cic->list, list) 1346 list_for_each_entry(cic, &cic->list, list)
1343 changed_ioprio(cic->cfqq); 1347 changed_ioprio(cic);
1344 1348
1345 return 0; 1349 return 0;
1346} 1350}
@@ -1429,10 +1433,10 @@ cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, gfp_t gfp_mask)
1429 * manually increment generic io_context usage count, it 1433 * manually increment generic io_context usage count, it
1430 * cannot go away since we are already holding one ref to it 1434 * cannot go away since we are already holding one ref to it
1431 */ 1435 */
1432 ioc->cic = cic;
1433 ioc->set_ioprio = cfq_ioc_set_ioprio;
1434 cic->ioc = ioc; 1436 cic->ioc = ioc;
1435 cic->key = cfqd; 1437 cic->key = cfqd;
1438 ioc->set_ioprio = cfq_ioc_set_ioprio;
1439 ioc->cic = cic;
1436 } else { 1440 } else {
1437 struct cfq_io_context *__cic; 1441 struct cfq_io_context *__cic;
1438 1442