[dm-devel] [PATCH] 1/3: Return test_interval from do_work()
Kevin Corry
kevcorry at us.ibm.com
Mon Jan 19 14:54:01 UTC 2004
In do_work(), return the minimum test_interval value of all mpath devices so
the daemon will periodically wake up and test the paths.
--- diff/drivers/md/dm-mpath.c 2004-01-19 12:50:31.000000000 -0600
+++ source/drivers/md/dm-mpath.c 2004-01-19 13:28:07.000000000 -0600
@@ -291,10 +291,14 @@
spin_unlock_irqrestore(&m->path_lock, flags);
}
+#define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r))
+
/* Multipathd does this every time it runs, returns a sleep duration hint */
static jiffy_t do_work(void)
{
struct multipath *m;
+ struct timespec t = {0,0};
+ unsigned interval = 0;
spin_lock(&_mpath_lock);
list_for_each_entry (m, &_mpaths, list) {
@@ -304,11 +308,15 @@
if (atomic_dec_and_test(&m->trigger_event))
dm_table_event(m->ti->table);
+
+ interval = min_not_zero(interval, m->test_interval);
}
spin_unlock(&_mpath_lock);
blk_run_queues();
- return (jiffy_t) 0;
+
+ t.tv_sec = interval;
+ return (jiffy_t) timespec_to_jiffies(&t);
}
/*-----------------------------------------------------------------
More information about the dm-devel
mailing list