diff options
author | NeilBrown <neilb@suse.de> | 2006-01-06 00:20:47 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 08:34:08 -0800 |
commit | 3b34380ae8c5df6debd85183c7fa1ac05f79b7d2 (patch) | |
tree | 9979f8b402b0566db286081eb7f5c26418964348 /drivers/md/md.c | |
parent | 03c902e17f40cfed63cd2494616f35fc9c58571b (diff) | |
download | lwn-3b34380ae8c5df6debd85183c7fa1ac05f79b7d2.tar.gz lwn-3b34380ae8c5df6debd85183c7fa1ac05f79b7d2.zip |
[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.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) static struct md_sysfs_entry md_raid_disks = __ATTR_RO(raid_disks); static ssize_t +chunk_size_show(mddev_t *mddev, char *page) +{ + return sprintf(page, "%d\n", mddev->chunk_size); +} + +static ssize_t +chunk_size_store(mddev_t *mddev, const char *buf, size_t len) +{ + /* can only set chunk_size if array is not yet active */ + char *e; + unsigned long n = simple_strtoul(buf, &e, 10); + + if (mddev->pers) + return -EBUSY; + if (!*buf || (*e && *e != '\n')) + return -EINVAL; + + mddev->chunk_size = n; + return len; +} +static struct md_sysfs_entry md_chunk_size = +__ATTR(chunk_size, 0644, chunk_size_show, chunk_size_store); + + +static ssize_t action_show(mddev_t *mddev, char *page) { char *type = "idle"; @@ -1861,6 +1886,7 @@ md_mismatches = __ATTR_RO(mismatch_cnt); static struct attribute *md_default_attrs[] = { &md_level.attr, &md_raid_disks.attr, + &md_chunk_size.attr, NULL, }; |