diff options
author | Jens Axboe <axboe@suse.de> | 2006-05-30 15:11:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-05-30 23:31:05 -0400 |
commit | 3793c65c13e4751c7a10f98198bae1758453eb0e (patch) | |
tree | 90cdca032861efbb982705f9d96e351681e48fef | |
parent | e60a48f5ab35737118e19bc965c640900a842f02 (diff) |
[PATCH] cfq-iosched: fixup locking and ->queue_list list management
- Drop cic from the list when seen as dead.
- Fixup the locking, just use a simple spinlock.
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | block/cfq-iosched.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 2540dfaa3e38..11ce6aaf1bd0 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -33,7 +33,7 @@ static int cfq_slice_idle = HZ / 70; | |||
33 | 33 | ||
34 | #define CFQ_KEY_ASYNC (0) | 34 | #define CFQ_KEY_ASYNC (0) |
35 | 35 | ||
36 | static DEFINE_RWLOCK(cfq_exit_lock); | 36 | static DEFINE_SPINLOCK(cfq_exit_lock); |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * for the hash of cfqq inside the cfqd | 39 | * for the hash of cfqq inside the cfqd |
@@ -1284,7 +1284,7 @@ static void cfq_exit_io_context(struct io_context *ioc) | |||
1284 | /* | 1284 | /* |
1285 | * put the reference this task is holding to the various queues | 1285 | * put the reference this task is holding to the various queues |
1286 | */ | 1286 | */ |
1287 | read_lock_irqsave(&cfq_exit_lock, flags); | 1287 | spin_lock_irqsave(&cfq_exit_lock, flags); |
1288 | 1288 | ||
1289 | n = rb_first(&ioc->cic_root); | 1289 | n = rb_first(&ioc->cic_root); |
1290 | while (n != NULL) { | 1290 | while (n != NULL) { |
@@ -1294,7 +1294,7 @@ static void cfq_exit_io_context(struct io_context *ioc) | |||
1294 | n = rb_next(n); | 1294 | n = rb_next(n); |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | read_unlock_irqrestore(&cfq_exit_lock, flags); | 1297 | spin_unlock_irqrestore(&cfq_exit_lock, flags); |
1298 | } | 1298 | } |
1299 | 1299 | ||
1300 | static struct cfq_io_context * | 1300 | static struct cfq_io_context * |
@@ -1400,17 +1400,17 @@ static int cfq_ioc_set_ioprio(struct io_context *ioc, unsigned int ioprio) | |||
1400 | struct cfq_io_context *cic; | 1400 | struct cfq_io_context *cic; |
1401 | struct rb_node *n; | 1401 | struct rb_node *n; |
1402 | 1402 | ||
1403 | write_lock(&cfq_exit_lock); | 1403 | spin_lock(&cfq_exit_lock); |
1404 | 1404 | ||
1405 | n = rb_first(&ioc->cic_root); | 1405 | n = rb_first(&ioc->cic_root); |
1406 | while (n != NULL) { | 1406 | while (n != NULL) { |
1407 | cic = rb_entry(n, struct cfq_io_context, rb_node); | 1407 | cic = rb_entry(n, struct cfq_io_context, rb_node); |
1408 | 1408 | ||
1409 | changed_ioprio(cic); | 1409 | changed_ioprio(cic); |
1410 | n = rb_next(n); | 1410 | n = rb_next(n); |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | write_unlock(&cfq_exit_lock); | 1413 | spin_unlock(&cfq_exit_lock); |
1414 | 1414 | ||
1415 | return 0; | 1415 | return 0; |
1416 | } | 1416 | } |
@@ -1475,9 +1475,10 @@ out: | |||
1475 | static void | 1475 | static void |
1476 | cfq_drop_dead_cic(struct io_context *ioc, struct cfq_io_context *cic) | 1476 | cfq_drop_dead_cic(struct io_context *ioc, struct cfq_io_context *cic) |
1477 | { | 1477 | { |
1478 | read_lock(&cfq_exit_lock); | 1478 | spin_lock(&cfq_exit_lock); |
1479 | rb_erase(&cic->rb_node, &ioc->cic_root); | 1479 | rb_erase(&cic->rb_node, &ioc->cic_root); |
1480 | read_unlock(&cfq_exit_lock); | 1480 | list_del_init(&cic->queue_list); |
1481 | spin_unlock(&cfq_exit_lock); | ||
1481 | kmem_cache_free(cfq_ioc_pool, cic); | 1482 | kmem_cache_free(cfq_ioc_pool, cic); |
1482 | atomic_dec(&ioc_count); | 1483 | atomic_dec(&ioc_count); |
1483 | } | 1484 | } |
@@ -1545,11 +1546,11 @@ restart: | |||
1545 | BUG(); | 1546 | BUG(); |
1546 | } | 1547 | } |
1547 | 1548 | ||
1548 | read_lock(&cfq_exit_lock); | 1549 | spin_lock(&cfq_exit_lock); |
1549 | rb_link_node(&cic->rb_node, parent, p); | 1550 | rb_link_node(&cic->rb_node, parent, p); |
1550 | rb_insert_color(&cic->rb_node, &ioc->cic_root); | 1551 | rb_insert_color(&cic->rb_node, &ioc->cic_root); |
1551 | list_add(&cic->queue_list, &cfqd->cic_list); | 1552 | list_add(&cic->queue_list, &cfqd->cic_list); |
1552 | read_unlock(&cfq_exit_lock); | 1553 | spin_unlock(&cfq_exit_lock); |
1553 | } | 1554 | } |
1554 | 1555 | ||
1555 | /* | 1556 | /* |
@@ -2187,7 +2188,7 @@ static void cfq_exit_queue(elevator_t *e) | |||
2187 | 2188 | ||
2188 | cfq_shutdown_timer_wq(cfqd); | 2189 | cfq_shutdown_timer_wq(cfqd); |
2189 | 2190 | ||
2190 | write_lock(&cfq_exit_lock); | 2191 | spin_lock(&cfq_exit_lock); |
2191 | spin_lock_irq(q->queue_lock); | 2192 | spin_lock_irq(q->queue_lock); |
2192 | 2193 | ||
2193 | if (cfqd->active_queue) | 2194 | if (cfqd->active_queue) |
@@ -2210,7 +2211,7 @@ static void cfq_exit_queue(elevator_t *e) | |||
2210 | } | 2211 | } |
2211 | 2212 | ||
2212 | spin_unlock_irq(q->queue_lock); | 2213 | spin_unlock_irq(q->queue_lock); |
2213 | write_unlock(&cfq_exit_lock); | 2214 | spin_unlock(&cfq_exit_lock); |
2214 | 2215 | ||
2215 | cfq_shutdown_timer_wq(cfqd); | 2216 | cfq_shutdown_timer_wq(cfqd); |
2216 | 2217 | ||