diff options
-rw-r--r-- | drivers/block/as-iosched.c | 2 | ||||
-rw-r--r-- | drivers/block/cfq-iosched.c | 22 | ||||
-rw-r--r-- | drivers/block/elevator.c | 21 |
3 files changed, 23 insertions, 22 deletions
diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c index 564172234819..c6744ff38294 100644 --- a/drivers/block/as-iosched.c +++ b/drivers/block/as-iosched.c | |||
@@ -1973,8 +1973,8 @@ static int __init as_init(void) | |||
1973 | 1973 | ||
1974 | static void __exit as_exit(void) | 1974 | static void __exit as_exit(void) |
1975 | { | 1975 | { |
1976 | kmem_cache_destroy(arq_pool); | ||
1977 | elv_unregister(&iosched_as); | 1976 | elv_unregister(&iosched_as); |
1977 | kmem_cache_destroy(arq_pool); | ||
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | module_init(as_init); | 1980 | module_init(as_init); |
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c index 94690e4d41e0..5281f8e70510 100644 --- a/drivers/block/cfq-iosched.c +++ b/drivers/block/cfq-iosched.c | |||
@@ -2418,28 +2418,8 @@ static int __init cfq_init(void) | |||
2418 | 2418 | ||
2419 | static void __exit cfq_exit(void) | 2419 | static void __exit cfq_exit(void) |
2420 | { | 2420 | { |
2421 | struct task_struct *g, *p; | ||
2422 | unsigned long flags; | ||
2423 | |||
2424 | read_lock_irqsave(&tasklist_lock, flags); | ||
2425 | |||
2426 | /* | ||
2427 | * iterate each process in the system, removing our io_context | ||
2428 | */ | ||
2429 | do_each_thread(g, p) { | ||
2430 | struct io_context *ioc = p->io_context; | ||
2431 | |||
2432 | if (ioc && ioc->cic) { | ||
2433 | ioc->cic->exit(ioc->cic); | ||
2434 | cfq_free_io_context(ioc->cic); | ||
2435 | ioc->cic = NULL; | ||
2436 | } | ||
2437 | } while_each_thread(g, p); | ||
2438 | |||
2439 | read_unlock_irqrestore(&tasklist_lock, flags); | ||
2440 | |||
2441 | cfq_slab_kill(); | ||
2442 | elv_unregister(&iosched_cfq); | 2421 | elv_unregister(&iosched_cfq); |
2422 | cfq_slab_kill(); | ||
2443 | } | 2423 | } |
2444 | 2424 | ||
2445 | module_init(cfq_init); | 2425 | module_init(cfq_init); |
diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c index 55621d5c5774..58e881bfd189 100644 --- a/drivers/block/elevator.c +++ b/drivers/block/elevator.c | |||
@@ -642,6 +642,27 @@ EXPORT_SYMBOL_GPL(elv_register); | |||
642 | 642 | ||
643 | void elv_unregister(struct elevator_type *e) | 643 | void elv_unregister(struct elevator_type *e) |
644 | { | 644 | { |
645 | struct task_struct *g, *p; | ||
646 | |||
647 | /* | ||
648 | * Iterate every thread in the process to remove the io contexts. | ||
649 | */ | ||
650 | read_lock(&tasklist_lock); | ||
651 | do_each_thread(g, p) { | ||
652 | struct io_context *ioc = p->io_context; | ||
653 | if (ioc && ioc->cic) { | ||
654 | ioc->cic->exit(ioc->cic); | ||
655 | ioc->cic->dtor(ioc->cic); | ||
656 | ioc->cic = NULL; | ||
657 | } | ||
658 | if (ioc && ioc->aic) { | ||
659 | ioc->aic->exit(ioc->aic); | ||
660 | ioc->aic->dtor(ioc->aic); | ||
661 | ioc->aic = NULL; | ||
662 | } | ||
663 | } while_each_thread(g, p); | ||
664 | read_unlock(&tasklist_lock); | ||
665 | |||
645 | spin_lock_irq(&elv_list_lock); | 666 | spin_lock_irq(&elv_list_lock); |
646 | list_del_init(&e->list); | 667 | list_del_init(&e->list); |
647 | spin_unlock_irq(&elv_list_lock); | 668 | spin_unlock_irq(&elv_list_lock); |