aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 0b3081aa4d63..9e57e97bd530 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1795,6 +1795,31 @@ raid_disks_show(mddev_t *mddev, char *page)
1795static struct md_sysfs_entry md_raid_disks = __ATTR_RO(raid_disks); 1795static struct md_sysfs_entry md_raid_disks = __ATTR_RO(raid_disks);
1796 1796
1797static ssize_t 1797static ssize_t
1798chunk_size_show(mddev_t *mddev, char *page)
1799{
1800 return sprintf(page, "%d\n", mddev->chunk_size);
1801}
1802
1803static ssize_t
1804chunk_size_store(mddev_t *mddev, const char *buf, size_t len)
1805{
1806 /* can only set chunk_size if array is not yet active */
1807 char *e;
1808 unsigned long n = simple_strtoul(buf, &e, 10);
1809
1810 if (mddev->pers)
1811 return -EBUSY;
1812 if (!*buf || (*e && *e != '\n'))
1813 return -EINVAL;
1814
1815 mddev->chunk_size = n;
1816 return len;
1817}
1818static struct md_sysfs_entry md_chunk_size =
1819__ATTR(chunk_size, 0644, chunk_size_show, chunk_size_store);
1820
1821
1822static ssize_t
1798action_show(mddev_t *mddev, char *page) 1823action_show(mddev_t *mddev, char *page)
1799{ 1824{
1800 char *type = "idle"; 1825 char *type = "idle";
@@ -1861,6 +1886,7 @@ md_mismatches = __ATTR_RO(mismatch_cnt);
1861static struct attribute *md_default_attrs[] = { 1886static struct attribute *md_default_attrs[] = {
1862 &md_level.attr, 1887 &md_level.attr,
1863 &md_raid_disks.attr, 1888 &md_raid_disks.attr,
1889 &md_chunk_size.attr,
1864 NULL, 1890 NULL,
1865}; 1891};
1866 1892