diff options
-rw-r--r-- | Documentation/md.txt | 6 | ||||
-rw-r--r-- | drivers/md/md.c | 23 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Documentation/md.txt b/Documentation/md.txt index d525fffc873b..866a1a887547 100644 --- a/Documentation/md.txt +++ b/Documentation/md.txt | |||
@@ -244,6 +244,12 @@ Each directory contains: | |||
244 | it currently fills. This can only be set while assembling an | 244 | it currently fills. This can only be set while assembling an |
245 | array. A device for which this is set is assumed to be working. | 245 | array. A device for which this is set is assumed to be working. |
246 | 246 | ||
247 | offset | ||
248 | This gives the location in the device (in sectors from the | ||
249 | start) where data from the array will be stored. Any part of | ||
250 | the device before this offset us not touched, unless it is | ||
251 | used for storing metadata (Formats 1.1 and 1.2). | ||
252 | |||
247 | 253 | ||
248 | An active md device will also contain and entry for each active device | 254 | An active md device will also contain and entry for each active device |
249 | in the array. These are named | 255 | in the array. These are named |
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 |