diff options
author | NeilBrown <neilb@suse.de> | 2006-01-06 03:21:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:34:10 -0500 |
commit | 83303b613d00718b07ec0a4dee7c99aa66629d96 (patch) | |
tree | e2c7c113d2f2f69aa426c3a3a355d84089bb13ce /drivers/md/md.c | |
parent | 6961ece46c7d02de1bb83914900608e39633787d (diff) |
[PATCH] md: allow available size of component devices to be set via sysfs
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 | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 27db100d8b12..40ac7fbab61f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1686,12 +1686,37 @@ offset_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
1686 | static struct rdev_sysfs_entry rdev_offset = | 1686 | static struct rdev_sysfs_entry rdev_offset = |
1687 | __ATTR(offset, 0644, offset_show, offset_store); | 1687 | __ATTR(offset, 0644, offset_show, offset_store); |
1688 | 1688 | ||
1689 | static ssize_t | ||
1690 | rdev_size_show(mdk_rdev_t *rdev, char *page) | ||
1691 | { | ||
1692 | return sprintf(page, "%llu\n", (unsigned long long)rdev->size); | ||
1693 | } | ||
1694 | |||
1695 | static ssize_t | ||
1696 | rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len) | ||
1697 | { | ||
1698 | char *e; | ||
1699 | unsigned long long size = simple_strtoull(buf, &e, 10); | ||
1700 | if (e==buf || (*e && *e != '\n')) | ||
1701 | return -EINVAL; | ||
1702 | if (rdev->mddev->pers) | ||
1703 | return -EBUSY; | ||
1704 | rdev->size = size; | ||
1705 | if (size < rdev->mddev->size || rdev->mddev->size == 0) | ||
1706 | rdev->mddev->size = size; | ||
1707 | return len; | ||
1708 | } | ||
1709 | |||
1710 | static struct rdev_sysfs_entry rdev_size = | ||
1711 | __ATTR(size, 0644, rdev_size_show, rdev_size_store); | ||
1712 | |||
1689 | static struct attribute *rdev_default_attrs[] = { | 1713 | static struct attribute *rdev_default_attrs[] = { |
1690 | &rdev_state.attr, | 1714 | &rdev_state.attr, |
1691 | &rdev_super.attr, | 1715 | &rdev_super.attr, |
1692 | &rdev_errors.attr, | 1716 | &rdev_errors.attr, |
1693 | &rdev_slot.attr, | 1717 | &rdev_slot.attr, |
1694 | &rdev_offset.attr, | 1718 | &rdev_offset.attr, |
1719 | &rdev_size.attr, | ||
1695 | NULL, | 1720 | NULL, |
1696 | }; | 1721 | }; |
1697 | static ssize_t | 1722 | static ssize_t |