aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-06-26 03:28:00 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 12:58:40 -0400
commita94213b1fa7b26dcc271bf4b4f9eebf1f1af33a2 (patch)
tree4954e6e461e2edf25bb63e9b286bfaea7a07a84a /drivers/md
parentd4dbd0250ea1d24bb3d2d13559432fa069d795e2 (diff)
[PATCH] md: Allow resync_start to be set and queried via sysfs
Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c26
1 files changed, 26 insertions, 0 deletions
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)