aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/md.txt6
-rw-r--r--drivers/md/md.c26
2 files changed, 32 insertions, 0 deletions
diff --git a/Documentation/md.txt b/Documentation/md.txt
index 80f158745ca5..f3d418ba625e 100644
--- a/Documentation/md.txt
+++ b/Documentation/md.txt
@@ -205,6 +205,12 @@ All md devices contain:
205 simply a number that is interpretted differently by different 205 simply a number that is interpretted differently by different
206 levels. It can be written while assembling an array. 206 levels. It can be written while assembling an array.
207 207
208 resync_start
209 The point at which resync should start. If no resync is needed,
210 this will be a very large number. At array creation it will
211 default to 0, though starting the array as 'clean' will
212 set it much larger.
213
208 new_dev 214 new_dev
209 This file can be written but not read. The value written should 215 This file can be written but not read. The value written should
210 be a block device number as major:minor. e.g. 8:0 216 be a block device number as major:minor. e.g. 8:0
diff --git a/drivers/md/md.c b/drivers/md/md.c
index e3261c438a65..8603c0692eab 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2235,6 +2235,30 @@ chunk_size_store(mddev_t *mddev, const char *buf, size_t len)
2235static struct md_sysfs_entry md_chunk_size = 2235static struct md_sysfs_entry md_chunk_size =
2236__ATTR(chunk_size, 0644, chunk_size_show, chunk_size_store); 2236__ATTR(chunk_size, 0644, chunk_size_show, chunk_size_store);
2237 2237
2238static ssize_t
2239resync_start_show(mddev_t *mddev, char *page)
2240{
2241 return sprintf(page, "%llu\n", (unsigned long long)mddev->recovery_cp);
2242}
2243
2244static ssize_t
2245resync_start_store(mddev_t *mddev, const char *buf, size_t len)
2246{
2247 /* can only set chunk_size if array is not yet active */
2248 char *e;
2249 unsigned long long n = simple_strtoull(buf, &e, 10);
2250
2251 if (mddev->pers)
2252 return -EBUSY;
2253 if (!*buf || (*e && *e != '\n'))
2254 return -EINVAL;
2255
2256 mddev->recovery_cp = n;
2257 return len;
2258}
2259static struct md_sysfs_entry md_resync_start =
2260__ATTR(resync_start, 0644, resync_start_show, resync_start_store);
2261
2238/* 2262/*
2239 * The array state can be: 2263 * The array state can be:
2240 * 2264 *
@@ -2771,6 +2795,7 @@ static struct attribute *md_default_attrs[] = {
2771 &md_raid_disks.attr, 2795 &md_raid_disks.attr,
2772 &md_chunk_size.attr, 2796 &md_chunk_size.attr,
2773 &md_size.attr, 2797 &md_size.attr,
2798 &md_resync_start.attr,
2774 &md_metadata.attr, 2799 &md_metadata.attr,
2775 &md_new_device.attr, 2800 &md_new_device.attr,
2776 &md_safe_delay.attr, 2801 &md_safe_delay.attr,
@@ -3263,6 +3288,7 @@ static int do_md_stop(mddev_t * mddev, int mode)
3263 mddev->array_size = 0; 3288 mddev->array_size = 0;
3264 mddev->size = 0; 3289 mddev->size = 0;
3265 mddev->raid_disks = 0; 3290 mddev->raid_disks = 0;
3291 mddev->recovery_cp = 0;
3266 3292
3267 disk = mddev->gendisk; 3293 disk = mddev->gendisk;
3268 if (disk) 3294 if (disk)