diff options
author | Artur Paszkiewicz <artur.paszkiewicz@intel.com> | 2017-03-09 12:00:03 +0300 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-03-17 02:55:56 +0300 |
commit | ba903a3ea465bd2f2bb9316054b295e79a7a518e (patch) | |
tree | 9eae9199e526deaa23791d7477bffcd910dbe463 /drivers/md/md.c | |
parent | 6358c239d88c751a9f14152a8d4ad2b69f5be48f (diff) | |
download | linux-ba903a3ea465bd2f2bb9316054b295e79a7a518e.tar.xz |
raid5-ppl: runtime PPL enabling or disabling
Allow writing to 'consistency_policy' attribute when the array is
active. Add a new function 'change_consistency_policy' to the
md_personality operations structure to handle the change in the
personality code. Values "ppl" and "resync" are accepted and
turn PPL on and off respectively.
When enabling PPL its location and size should first be set using
'ppl_sector' and 'ppl_size' attributes and a valid PPL header should be
written at this location on each member device.
Enabling or disabling PPL is performed under a suspended array. The
raid5_reset_stripe_cache function frees the stripe cache and allocates
it again in order to allocate or free the ppl_pages for the stripes in
the stripe cache.
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index a7740306cbbd..af9118711228 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4996,14 +4996,20 @@ consistency_policy_show(struct mddev *mddev, char *page) static ssize_t consistency_policy_store(struct mddev *mddev, const char *buf, size_t len) { + int err = 0; + if (mddev->pers) { - return -EBUSY; + if (mddev->pers->change_consistency_policy) + err = mddev->pers->change_consistency_policy(mddev, buf); + else + err = -EBUSY; } else if (mddev->external && strncmp(buf, "ppl", 3) == 0) { set_bit(MD_HAS_PPL, &mddev->flags); - return len; } else { - return -EINVAL; + err = -EINVAL; } + + return err ? err : len; } static struct md_sysfs_entry md_consistency_policy = |