Add parameter to flakey target to either start up or down - this allows one target to turn on when the other turns off. --- diff/drivers/md/dm-flakey.c 2004-01-22 13:40:25.000000000 -0600 +++ source/drivers/md/dm-flakey.c 2004-02-03 09:07:52.617127312 -0600 @@ -22,16 +22,17 @@ sector_t start; unsigned up_interval; unsigned down_interval; + unsigned start_up; }; /* - * Construct a flakey mapping: + * Construct a flakey mapping: */ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv) { struct flakey *f; - if (argc != 4) { + if (argc != 5) { ti->error = "dm-flakey: Invalid argument count"; return -EINVAL; } @@ -58,6 +59,11 @@ goto bad; } + if (sscanf(argv[4], "%u", &f->start_up) != 1) { + ti->error = "dm-flakey: invalid start_up parameter"; + goto bad; + } + if (dm_get_device(ti, argv[0], f->start, ti->len, dm_table_get_mode(ti->table), &f->dev)) { ti->error = "dm-flakey: Device lookup failed"; @@ -89,7 +95,9 @@ /* are we alive ? */ elapsed = (jiffies - f->start_time) / HZ; elapsed %= (f->up_interval + f->down_interval); - if (elapsed >= f->up_interval) + /* Use start_up param to determine which side of elapsed to check */ + if ((f->start_up && (elapsed >= f->up_interval)) || + (!f->start_up && (elapsed < f->up_interval))) return -EIO; else {