Add reinstate_path function (unused). --- diff/drivers/md/dm-mpath.c 2004-09-28 16:15:18.000000000 +0100 +++ source/drivers/md/dm-mpath.c 2004-09-28 16:18:11.000000000 +0100 @@ -514,6 +514,34 @@ spin_unlock_irqrestore(&path->failed_lock, flags); } +static int reinstate_path(struct path *path) +{ + int r = 0; + unsigned long flags; + struct multipath *m; + + spin_lock_irqsave(&path->failed_lock, flags); + + if (path->is_active) + goto out; + + r = path->pg->ps.type->reinstate_path(&path->pg->ps, path); + if (r) + goto out; + + path->is_active = 1; + m = path->pg->m; + + spin_lock(&m->lock); + m->nr_valid_paths++; + spin_unlock(&m->lock); + +out: + spin_unlock_irqrestore(&path->failed_lock, flags); + + return r; +} + static int do_end_io(struct multipath *m, struct bio *bio, int error, struct mpath_io *mpio) { --- diff/drivers/md/dm-path-selector.c 2004-09-28 16:15:18.000000000 +0100 +++ source/drivers/md/dm-path-selector.c 2004-09-28 16:18:11.000000000 +0100 @@ -272,6 +272,34 @@ spin_unlock_irqrestore(&s->lock, flags); } +static int rr_reinstate_path(struct path_selector *ps, struct path *p) +{ + int r = 0; + unsigned long flags; + struct selector *s = (struct selector *) ps->context; + struct path_info *pi; + + /* + * This function will be called infrequently so we don't + * mind the expense of these searches. + */ + spin_lock_irqsave(&s->lock, flags); + pi = path_lookup(&s->invalid_paths, p); + if (!pi) + pi = path_lookup(&s->valid_paths, p); + + if (pi) + list_move(&pi->list, &s->valid_paths); + else { + DMWARN("asked to change the state of an unknown path"); + r = -EINVAL; + } + + spin_unlock_irqrestore(&s->lock, flags); + + return r; +} + /* Path selector */ static struct path *rr_select_path(struct path_selector *ps, unsigned *repeat_count) @@ -307,6 +335,7 @@ .dtr = rr_dtr, .add_path = rr_add_path, .fail_path = rr_fail_path, + .reinstate_path = rr_reinstate_path, .select_path = rr_select_path, .status = rr_status, }; --- diff/drivers/md/dm-path-selector.h 2004-09-28 16:15:18.000000000 +0100 +++ source/drivers/md/dm-path-selector.h 2004-09-28 16:18:11.000000000 +0100 @@ -63,6 +63,12 @@ struct path *p); /* + * Ask selector to reinstate a path. + */ +typedef int (*ps_reinstate_path_fn) (struct path_selector *ps, + struct path *p); + +/* * Table content based on parameters added in ps_add_path_fn * or path selector status */ @@ -83,6 +89,7 @@ ps_add_path_fn add_path; ps_fail_path_fn fail_path; + ps_reinstate_path_fn reinstate_path; ps_select_path_fn select_path; ps_status_fn status; };