aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c23
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)
1664static struct rdev_sysfs_entry rdev_slot = 1664static struct rdev_sysfs_entry rdev_slot =
1665__ATTR(slot, 0644, slot_show, slot_store); 1665__ATTR(slot, 0644, slot_show, slot_store);
1666 1666
1667static ssize_t
1668offset_show(mdk_rdev_t *rdev, char *page)
1669{
1670 return sprintf(page, "%llu\n", rdev->data_offset);
1671}
1672
1673static ssize_t
1674offset_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
1686static struct rdev_sysfs_entry rdev_offset =
1687__ATTR(offset, 0644, offset_show, offset_store);
1688
1667static struct attribute *rdev_default_attrs[] = { 1689static 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};
1674static ssize_t 1697static ssize_t