diff options
author | Shaohua Li <shli@fb.com> | 2015-10-04 12:20:12 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.com> | 2015-10-31 22:48:27 -0400 |
commit | e6c033f79a0a1e9ca850575dcfa51bb583b592fa (patch) | |
tree | f3bc309e460231d295e36300ed1442dca875ac58 | |
parent | ac6096e9d5cb88a31f3af2d140df7d680b42745e (diff) |
raid5-cache: move reclaim stop to quiesce
Move reclaim stop to quiesce handling, where is safer for this stuff.
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: NeilBrown <neilb@suse.com>
-rw-r--r-- | drivers/md/raid5-cache.c | 30 | ||||
-rw-r--r-- | drivers/md/raid5.c | 1 | ||||
-rw-r--r-- | drivers/md/raid5.h | 1 |
3 files changed, 20 insertions, 12 deletions
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 0460882a5fd7..289ca3f5d4b3 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c | |||
@@ -748,6 +748,24 @@ static void r5l_wake_reclaim(struct r5l_log *log, sector_t space) | |||
748 | md_wakeup_thread(log->reclaim_thread); | 748 | md_wakeup_thread(log->reclaim_thread); |
749 | } | 749 | } |
750 | 750 | ||
751 | void r5l_quiesce(struct r5l_log *log, int state) | ||
752 | { | ||
753 | if (!log || state == 2) | ||
754 | return; | ||
755 | if (state == 0) { | ||
756 | log->reclaim_thread = md_register_thread(r5l_reclaim_thread, | ||
757 | log->rdev->mddev, "reclaim"); | ||
758 | } else if (state == 1) { | ||
759 | /* | ||
760 | * at this point all stripes are finished, so io_unit is at | ||
761 | * least in STRIPE_END state | ||
762 | */ | ||
763 | r5l_wake_reclaim(log, -1L); | ||
764 | md_unregister_thread(&log->reclaim_thread); | ||
765 | r5l_do_reclaim(log); | ||
766 | } | ||
767 | } | ||
768 | |||
751 | struct r5l_recovery_ctx { | 769 | struct r5l_recovery_ctx { |
752 | struct page *meta_page; /* current meta */ | 770 | struct page *meta_page; /* current meta */ |
753 | sector_t meta_total_blocks; /* total size of current meta and data */ | 771 | sector_t meta_total_blocks; /* total size of current meta and data */ |
@@ -1120,19 +1138,7 @@ io_kc: | |||
1120 | 1138 | ||
1121 | void r5l_exit_log(struct r5l_log *log) | 1139 | void r5l_exit_log(struct r5l_log *log) |
1122 | { | 1140 | { |
1123 | /* | ||
1124 | * at this point all stripes are finished, so io_unit is at least in | ||
1125 | * STRIPE_END state | ||
1126 | */ | ||
1127 | r5l_wake_reclaim(log, -1L); | ||
1128 | md_unregister_thread(&log->reclaim_thread); | 1141 | md_unregister_thread(&log->reclaim_thread); |
1129 | r5l_do_reclaim(log); | ||
1130 | /* | ||
1131 | * force a super update, r5l_do_reclaim might updated the super. | ||
1132 | * mddev->thread is already stopped | ||
1133 | */ | ||
1134 | md_update_sb(log->rdev->mddev, 1); | ||
1135 | |||
1136 | kmem_cache_destroy(log->io_kc); | 1142 | kmem_cache_destroy(log->io_kc); |
1137 | kfree(log); | 1143 | kfree(log); |
1138 | } | 1144 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index a622ccb3477a..216fa3c64287 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -7582,6 +7582,7 @@ static void raid5_quiesce(struct mddev *mddev, int state) | |||
7582 | unlock_all_device_hash_locks_irq(conf); | 7582 | unlock_all_device_hash_locks_irq(conf); |
7583 | break; | 7583 | break; |
7584 | } | 7584 | } |
7585 | r5l_quiesce(conf->log, state); | ||
7585 | } | 7586 | } |
7586 | 7587 | ||
7587 | static void *raid45_takeover_raid0(struct mddev *mddev, int level) | 7588 | static void *raid45_takeover_raid0(struct mddev *mddev, int level) |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 32c8ce81248b..1ab534c909fe 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -630,4 +630,5 @@ extern void r5l_write_stripe_run(struct r5l_log *log); | |||
630 | extern void r5l_flush_stripe_to_raid(struct r5l_log *log); | 630 | extern void r5l_flush_stripe_to_raid(struct r5l_log *log); |
631 | extern void r5l_stripe_write_finished(struct stripe_head *sh); | 631 | extern void r5l_stripe_write_finished(struct stripe_head *sh); |
632 | extern int r5l_handle_flush_request(struct r5l_log *log, struct bio *bio); | 632 | extern int r5l_handle_flush_request(struct r5l_log *log, struct bio *bio); |
633 | extern void r5l_quiesce(struct r5l_log *log, int state); | ||
633 | #endif | 634 | #endif |