[dm-devel] Multipath Questions

Kevin Corry kevcorry at us.ibm.com
Fri Jan 16 12:02:01 UTC 2004


On Friday 16 January 2004 08:32, Joe Thornber wrote:
> On Wed, Jan 14, 2004 at 01:36:49PM -0600, Kevin Corry wrote:
> > Obviously the daemon needs a way to wake-up periodically so it can run
> > it's test I/Os. The comments in dm-daemon.h say the worker function
> > should return a "hint" as to when they should be woken up, but currently
> > this return value is unused. I'm trying to look into how to implement
> > this functionality in the dm-daemon code, but I figured I'd ask here and
> > see if anyone has already come up with a plan for this. Once we get the
> > multipath daemon to do its periodic path-testing, I think we'll have a
> > working prototype.
>
> schedule_timeout() ?

Aha...so we could just do something like this in dm-daemon?

--- diff/drivers/md/dm-daemon.c	2004-01-16 10:41:44.000000000 -0600
+++ source/drivers/md/dm-daemon.c	2004-01-16 10:43:52.000000000 -0600
@@ -16,6 +16,7 @@
 {
 	struct dm_daemon *dd = (struct dm_daemon *) arg;
 	DECLARE_WAITQUEUE(wq, current);
+	jiffy_t timeout;
 
 	daemonize("%s", dd->name);
 
@@ -42,12 +43,15 @@
 		do {
 			set_current_state(TASK_RUNNING);
 			atomic_set(&dd->woken, 0);
-			dd->fn();
+			timeout = dd->fn();
 			set_current_state(TASK_INTERRUPTIBLE);
 
 		} while (atomic_read(&dd->woken));
 
-		schedule();
+		if (timeout)
+			schedule_timeout(timeout);
+		else
+			schedule();
 	}
 
  out:


-- 
Kevin Corry
kevcorry at us.ibm.com
http://evms.sourceforge.net/





More information about the dm-devel mailing list