aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-01-06 03:20:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:34:08 -0500
commit3b34380ae8c5df6debd85183c7fa1ac05f79b7d2 (patch)
tree9979f8b402b0566db286081eb7f5c26418964348 /drivers/md/md.c
parent03c902e17f40cfed63cd2494616f35fc9c58571b (diff)
[PATCH] md: allow chunk_size to be settable through sysfs
... only before array is started of course. Signed-off-by: Neil Brown <neilb@suse.de> Acked-by: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/md.c')
-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