dm-mpath.c: There's no need to store the priority for each group in the kernel, all we're interested in is their relative priority. Which is given implicitly by the group orderings in the constructor args. --- diff/drivers/md/dm-mpath.c 2004-02-25 14:34:29.000000000 +0000 +++ source/drivers/md/dm-mpath.c 2004-02-25 14:20:34.000000000 +0000 @@ -51,7 +51,6 @@ struct path { struct priority_group { struct list_head list; - unsigned priority; struct multipath *m; struct path_selector *ps; @@ -375,7 +374,6 @@ static struct priority_group *parse_prio struct dm_target *ti) { static struct param _params[] = { - {0, 1024, ESTR("invalid priority")}, {1, 1024, ESTR("invalid number of paths")}, {0, 1024, ESTR("invalid number of selector args")} }; @@ -385,7 +383,7 @@ static struct priority_group *parse_prio struct priority_group *pg; struct path_selector_type *pst; - if (as->argc < 3) { + if (as->argc < 2) { as->argc = 0; ti->error = ESTR("not enough priority group aruments"); return NULL; @@ -397,10 +395,6 @@ static struct priority_group *parse_prio return NULL; } - r = read_param(_params, shift(as), &pg->priority, &ti->error); - if (r) - goto bad; - pst = dm_get_path_selector(shift(as)); if (!pst) { ti->error = ESTR("unknown path selector type"); @@ -418,11 +412,11 @@ static struct priority_group *parse_prio /* * read the paths */ - r = read_param(_params + 1, shift(as), &pg->nr_paths, &ti->error); + r = read_param(_params, shift(as), &pg->nr_paths, &ti->error); if (r) goto bad; - r = read_param(_params + 2, shift(as), &nr_selector_args, &ti->error); + r = read_param(_params + 1, shift(as), &nr_selector_args, &ti->error); if (r) goto bad; @@ -453,19 +447,6 @@ static struct priority_group *parse_prio return NULL; } -static void __insert_priority_group(struct multipath *m, - struct priority_group *pg) -{ - struct priority_group *tmp; - - list_for_each_entry (tmp, &m->priority_groups, list) - if (tmp->priority > pg->priority) - break; - - list_add_tail(&pg->list, &tmp->list); - pg->m = m; -} - static int multipath_ctr(struct dm_target *ti, unsigned int argc, char **argv) { @@ -495,10 +476,11 @@ static int multipath_ctr(struct dm_targe while (as.argc) { struct priority_group *pg; pg = parse_priority_group(&as, m, ti); - if (pg) { - m->nr_paths += pg->nr_paths; - __insert_priority_group(m, pg); - } + if (!pg) + goto bad; + + m->nr_paths += pg->nr_paths; + list_add_tail(&pg->list, &m->priority_groups); } m->nr_valid_paths = m->nr_paths; @@ -657,8 +639,7 @@ static int multipath_status(struct dm_ta EMIT("%u ", m->nr_priority_groups); list_for_each_entry(pg, &m->priority_groups, list) { - EMIT("%u %s %u %u ", - pg->priority, pg->ps->type->name, + EMIT("%s %u %u ", pg->ps->type->name, pg->nr_paths, pg->ps->type->table_args); list_for_each_entry(p, &pg->paths, list) {