diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index a8169564209d..742a82a4d10b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1664,11 +1664,34 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
1664 | static struct rdev_sysfs_entry rdev_slot = | 1664 | static struct rdev_sysfs_entry rdev_slot = |
1665 | __ATTR(slot, 0644, slot_show, slot_store); | 1665 | __ATTR(slot, 0644, slot_show, slot_store); |
1666 | 1666 | ||
1667 | static ssize_t | ||
1668 | offset_show(mdk_rdev_t *rdev, char *page) | ||
1669 | { | ||
1670 | return sprintf(page, "%llu\n", rdev->data_offset); | ||
1671 | } | ||
1672 | |||
1673 | static ssize_t | ||
1674 | offset_store(mdk_rdev_t *rdev, const char *buf, size_t len) | ||
1675 | { | ||
1676 | char *e; | ||
1677 | unsigned long long offset = simple_strtoull(buf, &e, 10); | ||
1678 | if (e==buf || (*e && *e != '\n')) | ||
1679 | return -EINVAL; | ||
1680 | if (rdev->mddev->pers) | ||
1681 | return -EBUSY; | ||
1682 | rdev->data_offset = offset; | ||
1683 | return len; | ||
1684 | } | ||
1685 | |||
1686 | static struct rdev_sysfs_entry rdev_offset = | ||
1687 | __ATTR(offset, 0644, offset_show, offset_store); | ||
1688 | |||
1667 | static struct attribute *rdev_default_attrs[] = { | 1689 | static struct attribute *rdev_default_attrs[] = { |
1668 | &rdev_state.attr, | 1690 | &rdev_state.attr, |
1669 | &rdev_super.attr, | 1691 | &rdev_super.attr, |
1670 | &rdev_errors.attr, | 1692 | &rdev_errors.attr, |
1671 | &rdev_slot.attr, | 1693 | &rdev_slot.attr, |
1694 | &rdev_offset.attr, | ||
1672 | NULL, | 1695 | NULL, |
1673 | }; | 1696 | }; |
1674 | static ssize_t | 1697 | static ssize_t |