Make round-robin repeat count per-path. --- diff/drivers/md/dm-mpath.c 2004-09-28 17:41:41.000000000 +0100 +++ source/drivers/md/dm-mpath.c 2004-09-28 17:09:27.000000000 +0100 @@ -678,7 +678,7 @@ return -EINVAL; } - DMINFO("dm_multipath v0.2.0"); + DMINFO("dm_multipath version 0.2.1 loaded"); return r; } --- diff/drivers/md/dm-roundrobin.c 2004-09-28 17:41:41.000000000 +0100 +++ source/drivers/md/dm-roundrobin.c 2004-09-28 17:40:58.000000000 +0100 @@ -19,6 +19,7 @@ struct path_info { struct list_head list; struct path *path; + unsigned repeat_count; }; static struct path_info *path_lookup(struct list_head *head, struct path *p) @@ -43,11 +44,9 @@ struct list_head valid_paths; struct list_head invalid_paths; - - unsigned repeat_count; }; -static struct selector *alloc_selector(unsigned repeat_count) +static struct selector *alloc_selector(void) { struct selector *s = kmalloc(sizeof(*s), GFP_KERNEL); @@ -55,7 +54,6 @@ INIT_LIST_HEAD(&s->valid_paths); INIT_LIST_HEAD(&s->invalid_paths); s->lock = SPIN_LOCK_UNLOCKED; - s->repeat_count = repeat_count; } return s; @@ -66,8 +64,7 @@ { struct selector *s; - /* FIXME Parameter passed in */ - s = alloc_selector(RR_MIN_IO); + s = alloc_selector(); if (!s) return -ENOMEM; @@ -100,9 +97,15 @@ { struct selector *s = (struct selector *) ps->context; struct path_info *pi; + unsigned repeat_count = RR_MIN_IO; - /* parse the path arguments */ - if (argc != 0) { + /* First path argument is number of I/Os before switching path */ + if (argc == 1) { + if (sscanf(argv[0], "%u", &repeat_count) != 1) { + *error = "round-robin ps: invalid repeat count"; + return -EINVAL; + } + } else if (argc != 0) { *error = "round-robin ps: incorrect number of arguments"; return -EINVAL; } @@ -115,6 +118,7 @@ } pi->path = path; + pi->repeat_count = repeat_count; spin_lock(&s->lock); list_add(&pi->list, &s->valid_paths); @@ -166,7 +170,7 @@ if (pi) list_move(&pi->list, &s->valid_paths); else { - DMWARN("asked to change the state of an unknown path"); + DMWARN("asked to reinstate an unknown path"); r = -EINVAL; } @@ -187,7 +191,7 @@ if (!list_empty(&s->valid_paths)) { pi = list_entry(s->valid_paths.next, struct path_info, list); list_move_tail(&pi->list, &s->valid_paths); - *repeat_count = RR_MIN_IO; + *repeat_count = pi->repeat_count; } spin_unlock_irqrestore(&s->lock, flags); @@ -222,6 +226,8 @@ if (r < 0) DMERR("round-robin: register failed %d", r); + DMINFO("dm-roundrobin version 0.2.1 loaded"); + return r; }