diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 26 |
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) | |||
1795 | static struct md_sysfs_entry md_raid_disks = __ATTR_RO(raid_disks); | 1795 | static struct md_sysfs_entry md_raid_disks = __ATTR_RO(raid_disks); |
1796 | 1796 | ||
1797 | static ssize_t | 1797 | static ssize_t |
1798 | chunk_size_show(mddev_t *mddev, char *page) | ||
1799 | { | ||
1800 | return sprintf(page, "%d\n", mddev->chunk_size); | ||
1801 | } | ||
1802 | |||
1803 | static ssize_t | ||
1804 | chunk_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 | } | ||
1818 | static struct md_sysfs_entry md_chunk_size = | ||
1819 | __ATTR(chunk_size, 0644, chunk_size_show, chunk_size_store); | ||
1820 | |||
1821 | |||
1822 | static ssize_t | ||
1798 | action_show(mddev_t *mddev, char *page) | 1823 | action_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); | |||
1861 | static struct attribute *md_default_attrs[] = { | 1886 | static 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 | ||