From 0dd3ba30aa1fbab2d7e62fca5169789ceb62b3f1 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sun, 28 Sep 2008 12:12:06 -0700 Subject: --wait-clean: shorten timeout Set the safemode timeout to a small value to get the array marked clean as soon as possible. We don't write 'clean' directly as it may cause mdmon to miss a 'write-pending' event. Include a couple fixes to sysfs_set_safemode(): 1/ 0 pad the milliseconds field 2/ workaround input truncation in the kernel Signed-off-by: Dan Williams --- sysfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sysfs.c') diff --git a/sysfs.c b/sysfs.c index 291a1dc..23d2f18 100644 --- a/sysfs.c +++ b/sysfs.c @@ -436,9 +436,10 @@ int sysfs_set_safemode(struct mdinfo *sra, unsigned long ms) char delay[30]; sec = ms / 1000; - msec = ms - (sec * 1000); + msec = ms % 1000; - sprintf(delay, "%ld.%ld", sec, msec); + sprintf(delay, "%ld.%03ld\n", sec, msec); + /* this '\n' ^ needed for kernels older than 2.6.28 */ return sysfs_set_str(sra, NULL, "safe_mode_delay", delay); } -- cgit