From 968b5136c590dc9acc637f50de9f219be98c40ef Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 6 Jan 2006 00:20:56 -0800 Subject: [PATCH] --- yaml --- r: 16569 b: refs/heads/master c: 93c8cad03f02dbd1532a5413bdced25f000d5728 h: refs/heads/master i: 16567: b513f71885e244136d64453a997d2c0f4cf70dfd v: v3 --- [refs] | 2 +- trunk/Documentation/md.txt | 6 ++++++ trunk/drivers/md/md.c | 23 +++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 3dbe34e21a0c..e8850dd94e84 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 014236d2b8ec6faea2a6134ab8e019d84d67b524 +refs/heads/master: 93c8cad03f02dbd1532a5413bdced25f000d5728 diff --git a/trunk/Documentation/md.txt b/trunk/Documentation/md.txt index d525fffc873b..866a1a887547 100644 --- a/trunk/Documentation/md.txt +++ b/trunk/Documentation/md.txt @@ -244,6 +244,12 @@ Each directory contains: it currently fills. This can only be set while assembling an array. A device for which this is set is assumed to be working. + offset + This gives the location in the device (in sectors from the + start) where data from the array will be stored. Any part of + the device before this offset us not touched, unless it is + used for storing metadata (Formats 1.1 and 1.2). + An active md device will also contain and entry for each active device in the array. These are named diff --git a/trunk/drivers/md/md.c b/trunk/drivers/md/md.c index a8169564209d..742a82a4d10b 100644 --- a/trunk/drivers/md/md.c +++ b/trunk/drivers/md/md.c @@ -1664,11 +1664,34 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) static struct rdev_sysfs_entry rdev_slot = __ATTR(slot, 0644, slot_show, slot_store); +static ssize_t +offset_show(mdk_rdev_t *rdev, char *page) +{ + return sprintf(page, "%llu\n", rdev->data_offset); +} + +static ssize_t +offset_store(mdk_rdev_t *rdev, const char *buf, size_t len) +{ + char *e; + unsigned long long offset = simple_strtoull(buf, &e, 10); + if (e==buf || (*e && *e != '\n')) + return -EINVAL; + if (rdev->mddev->pers) + return -EBUSY; + rdev->data_offset = offset; + return len; +} + +static struct rdev_sysfs_entry rdev_offset = +__ATTR(offset, 0644, offset_show, offset_store); + static struct attribute *rdev_default_attrs[] = { &rdev_state.attr, &rdev_super.attr, &rdev_errors.attr, &rdev_slot.attr, + &rdev_offset.attr, NULL, }; static ssize_t