aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5-log.h
diff options
context:
space:
mode:
authorArtur Paszkiewicz <artur.paszkiewicz@intel.com>2017-04-04 13:13:57 +0200
committerShaohua Li <shli@fb.com>2017-04-10 12:00:49 -0700
commit845b9e229fe0716ab6b4d94b4364c99069667b59 (patch)
tree8c0ac896475505669b3f8665d053d2660d997e29 /drivers/md/raid5-log.h
parentraid5-ppl: move no_mem_stripes to struct ppl_conf (diff)
downloadlinux-dev-845b9e229fe0716ab6b4d94b4364c99069667b59.tar.xz
linux-dev-845b9e229fe0716ab6b4d94b4364c99069667b59.zip
raid5-ppl: use resize_stripes() when enabling or disabling ppl
Use resize_stripes() instead of raid5_reset_stripe_cache() to allocate or free sh->ppl_page at runtime for all stripes in the stripe cache. raid5_reset_stripe_cache() required suspending the mddev and could deadlock because of GFP_KERNEL allocations. Move the 'newsize' check to check_reshape() to allow reallocating the stripes with the same number of disks. Allocate sh->ppl_page in alloc_stripe() instead of grow_buffers(). Pass 'struct r5conf *conf' as a parameter to alloc_stripe() because it is needed to check whether to allocate ppl_page. Add free_stripe() and use it to free stripes rather than directly call kmem_cache_free(). Also free sh->ppl_page in free_stripe(). Set MD_HAS_PPL at the end of ppl_init_log() instead of explicitly setting it in advance and add another parameter to log_init() to allow calling ppl_init_log() without the bit set. Don't try to calculate partial parity or add a stripe to log if it does not have ppl_page set. Enabling ppl can now be performed without suspending the mddev, because the log won't be used until new stripes are allocated with ppl_page. Calling mddev_suspend/resume is still necessary when disabling ppl, because we want all stripes to finish before stopping the log, but resize_stripes() can be called after mddev_resume() when ppl is no longer active. Suggested-by: NeilBrown <neilb@suse.com> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid5-log.h')
-rw-r--r--drivers/md/raid5-log.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h
index 738930ff5d17..27097101ccca 100644
--- a/drivers/md/raid5-log.h
+++ b/drivers/md/raid5-log.h
@@ -93,11 +93,12 @@ static inline void log_exit(struct r5conf *conf)
ppl_exit_log(conf);
}
-static inline int log_init(struct r5conf *conf, struct md_rdev *journal_dev)
+static inline int log_init(struct r5conf *conf, struct md_rdev *journal_dev,
+ bool ppl)
{
if (journal_dev)
return r5l_init_log(conf, journal_dev);
- else if (raid5_has_ppl(conf))
+ else if (ppl)
return ppl_init_log(conf);
return 0;