aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/raid5.c44
-rw-r--r--drivers/md/raid5.h1
2 files changed, 45 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index c82ce1fd8723..f78b1964543b 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5880,6 +5880,49 @@ raid5_stripecache_size = __ATTR(stripe_cache_size, S_IRUGO | S_IWUSR,
5880 raid5_store_stripe_cache_size); 5880 raid5_store_stripe_cache_size);
5881 5881
5882static ssize_t 5882static ssize_t
5883raid5_show_rmw_level(struct mddev *mddev, char *page)
5884{
5885 struct r5conf *conf = mddev->private;
5886 if (conf)
5887 return sprintf(page, "%d\n", conf->rmw_level);
5888 else
5889 return 0;
5890}
5891
5892static ssize_t
5893raid5_store_rmw_level(struct mddev *mddev, const char *page, size_t len)
5894{
5895 struct r5conf *conf = mddev->private;
5896 unsigned long new;
5897
5898 if (!conf)
5899 return -ENODEV;
5900
5901 if (len >= PAGE_SIZE)
5902 return -EINVAL;
5903
5904 if (kstrtoul(page, 10, &new))
5905 return -EINVAL;
5906
5907 if (new != PARITY_DISABLE_RMW && !raid6_call.xor_syndrome)
5908 return -EINVAL;
5909
5910 if (new != PARITY_DISABLE_RMW &&
5911 new != PARITY_ENABLE_RMW &&
5912 new != PARITY_PREFER_RMW)
5913 return -EINVAL;
5914
5915 conf->rmw_level = new;
5916 return len;
5917}
5918
5919static struct md_sysfs_entry
5920raid5_rmw_level = __ATTR(rmw_level, S_IRUGO | S_IWUSR,
5921 raid5_show_rmw_level,
5922 raid5_store_rmw_level);
5923
5924
5925static ssize_t
5883raid5_show_preread_threshold(struct mddev *mddev, char *page) 5926raid5_show_preread_threshold(struct mddev *mddev, char *page)
5884{ 5927{
5885 struct r5conf *conf; 5928 struct r5conf *conf;
@@ -6065,6 +6108,7 @@ static struct attribute *raid5_attrs[] = {
6065 &raid5_preread_bypass_threshold.attr, 6108 &raid5_preread_bypass_threshold.attr,
6066 &raid5_group_thread_cnt.attr, 6109 &raid5_group_thread_cnt.attr,
6067 &raid5_skip_copy.attr, 6110 &raid5_skip_copy.attr,
6111 &raid5_rmw_level.attr,
6068 NULL, 6112 NULL,
6069}; 6113};
6070static struct attribute_group raid5_attrs_group = { 6114static struct attribute_group raid5_attrs_group = {
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 57fef9ba36fa..6614ac5ffc0e 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -362,6 +362,7 @@ enum {
362enum { 362enum {
363 PARITY_DISABLE_RMW = 0, 363 PARITY_DISABLE_RMW = 0,
364 PARITY_ENABLE_RMW, 364 PARITY_ENABLE_RMW,
365 PARITY_PREFER_RMW,
365}; 366};
366 367
367/* 368/*