aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMarkus Stockhausen <stockhausen@collogia.de>2014-12-14 20:57:05 -0500
committerNeilBrown <neilb@suse.de>2015-04-21 18:00:42 -0400
commitd06f191f8ecaef4d524e765fdb455f96392fbd42 (patch)
tree3e83449b9fb3c910a7a6d65a776304dd158e18c4 /drivers/md
parent584acdd49cd2472ca0f5a06adbe979db82d0b4af (diff)
md/raid5: introduce configuration option rmw_level
Depending on the available coding we allow optimized rmw logic for write operations. To support easier testing this patch allows manual control of the rmw/rcw descision through the interface /sys/block/mdX/md/rmw_level. The configuration can handle three levels of control. rmw_level=0: Disable rmw for all RAID types. Hardware assisted P/Q calculation has no implementation path yet to factor in/out chunks of a syndrome. Enforcing this level can be benefical for slow CPUs with hardware syndrome support and fast SSDs. rmw_level=1: Estimate rmw IOs and rcw IOs. Execute rmw only if we will save IOs. This equals the "old" unpatched behaviour and will be the default. rmw_level=2: Execute rmw even if calculated IOs for rmw and rcw are equal. We might have higher CPU consumption because of calculating the parity twice but it can be benefical otherwise. E.g. RAID4 with fast dedicated parity disk/SSD. The option is implemented just to be forward-looking and will ONLY work with this patch! Signed-off-by: Markus Stockhausen <stockhausen@collogia.de> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-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/*