summaryrefslogtreecommitdiff
path: root/drivers/md/raid5-cache.c
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2015-10-04 19:20:12 +0300
committerNeilBrown <neilb@suse.com>2015-11-01 05:48:27 +0300
commite6c033f79a0a1e9ca850575dcfa51bb583b592fa (patch)
treef3bc309e460231d295e36300ed1442dca875ac58 /drivers/md/raid5-cache.c
parentac6096e9d5cb88a31f3af2d140df7d680b42745e (diff)
downloadlinux-e6c033f79a0a1e9ca850575dcfa51bb583b592fa.tar.xz
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>
Diffstat (limited to 'drivers/md/raid5-cache.c')
-rw-r--r--drivers/md/raid5-cache.c30
1 files changed, 18 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)
md_wakeup_thread(log->reclaim_thread);
}
+void r5l_quiesce(struct r5l_log *log, int state)
+{
+ if (!log || state == 2)
+ return;
+ if (state == 0) {
+ log->reclaim_thread = md_register_thread(r5l_reclaim_thread,
+ log->rdev->mddev, "reclaim");
+ } else if (state == 1) {
+ /*
+ * at this point all stripes are finished, so io_unit is at
+ * least in STRIPE_END state
+ */
+ r5l_wake_reclaim(log, -1L);
+ md_unregister_thread(&log->reclaim_thread);
+ r5l_do_reclaim(log);
+ }
+}
+
struct r5l_recovery_ctx {
struct page *meta_page; /* current meta */
sector_t meta_total_blocks; /* total size of current meta and data */
@@ -1120,19 +1138,7 @@ io_kc:
void r5l_exit_log(struct r5l_log *log)
{
- /*
- * at this point all stripes are finished, so io_unit is at least in
- * STRIPE_END state
- */
- r5l_wake_reclaim(log, -1L);
md_unregister_thread(&log->reclaim_thread);
- r5l_do_reclaim(log);
- /*
- * force a super update, r5l_do_reclaim might updated the super.
- * mddev->thread is already stopped
- */
- md_update_sb(log->rdev->mddev, 1);
-
kmem_cache_destroy(log->io_kc);
kfree(log);
}