aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c25
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)
1686static struct rdev_sysfs_entry rdev_offset = 1686static struct rdev_sysfs_entry rdev_offset =
1687__ATTR(offset, 0644, offset_show, offset_store); 1687__ATTR(offset, 0644, offset_show, offset_store);
1688 1688
1689static ssize_t
1690rdev_size_show(mdk_rdev_t *rdev, char *page)
1691{
1692 return sprintf(page, "%llu\n", (unsigned long long)rdev->size);
1693}
1694
1695static ssize_t
1696rdev_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
1710static struct rdev_sysfs_entry rdev_size =
1711__ATTR(size, 0644, rdev_size_show, rdev_size_store);
1712
1689static struct attribute *rdev_default_attrs[] = { 1713static 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};
1697static ssize_t 1722static ssize_t