diff options
Diffstat (limited to 'block/elevator.c')
-rw-r--r-- | block/elevator.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/block/elevator.c b/block/elevator.c index 24b702d649a9..0232df2b16e6 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -675,21 +675,15 @@ void elv_unregister(struct elevator_type *e) | |||
675 | /* | 675 | /* |
676 | * Iterate every thread in the process to remove the io contexts. | 676 | * Iterate every thread in the process to remove the io contexts. |
677 | */ | 677 | */ |
678 | read_lock(&tasklist_lock); | 678 | if (e->ops.trim) { |
679 | do_each_thread(g, p) { | 679 | read_lock(&tasklist_lock); |
680 | struct io_context *ioc = p->io_context; | 680 | do_each_thread(g, p) { |
681 | if (ioc && ioc->cic) { | 681 | task_lock(p); |
682 | ioc->cic->exit(ioc->cic); | 682 | e->ops.trim(p->io_context); |
683 | ioc->cic->dtor(ioc->cic); | 683 | task_unlock(p); |
684 | ioc->cic = NULL; | 684 | } while_each_thread(g, p); |
685 | } | 685 | read_unlock(&tasklist_lock); |
686 | if (ioc && ioc->aic) { | 686 | } |
687 | ioc->aic->exit(ioc->aic); | ||
688 | ioc->aic->dtor(ioc->aic); | ||
689 | ioc->aic = NULL; | ||
690 | } | ||
691 | } while_each_thread(g, p); | ||
692 | read_unlock(&tasklist_lock); | ||
693 | 687 | ||
694 | spin_lock_irq(&elv_list_lock); | 688 | spin_lock_irq(&elv_list_lock); |
695 | list_del_init(&e->list); | 689 | list_del_init(&e->list); |