Some variable renaming. pg.ps no longer pointer. --- diff/drivers/md/dm-mpath.c 2004-09-28 15:11:35.000000000 +0100 +++ source/drivers/md/dm-mpath.c 2004-09-28 15:46:19.000000000 +0100 @@ -52,7 +52,7 @@ struct list_head list; struct multipath *m; - struct path_selector *ps; + struct path_selector ps; unsigned nr_paths; struct list_head paths; @@ -121,13 +121,7 @@ if (!pg) return NULL; - pg->ps = kmalloc(sizeof(*pg->ps), GFP_KERNEL); - if (!pg->ps) { - kfree(pg); - return NULL; - } - memset(pg->ps, 0, sizeof(*pg->ps)); - + memset(pg, 0, sizeof(*pg)); INIT_LIST_HEAD(&pg->paths); return pg; @@ -147,14 +141,11 @@ static void free_priority_group(struct priority_group *pg, struct dm_target *ti) { - struct path_selector *ps = pg->ps; + struct path_selector *ps = &pg->ps; - if (ps) { - if (ps->type) { - ps->type->dtr(ps); - dm_put_path_selector(ps->type); - } - kfree(ps); + if (ps->type) { + ps->type->dtr(ps); + dm_put_path_selector(ps->type); } free_paths(&pg->paths, ti); @@ -207,7 +198,7 @@ if (m->nr_valid_paths) { /* loop through the priority groups until we find a valid path. */ list_for_each_entry (pg, &m->priority_groups, list) { - path = pg->ps->type->select_path(pg->ps); + path = pg->ps.type->select_path(&pg->ps); if (path) break; } @@ -393,13 +384,13 @@ goto bad; } - r = pst->ctr(pg->ps); + r = pst->ctr(&pg->ps); if (r) { /* FIXME: need to put the pst ? fix after * factoring out the register */ goto bad; } - pg->ps->type = pst; + pg->ps.type = pst; /* * read the paths @@ -423,7 +414,7 @@ path_args.argc = nr_params; path_args.argv = as->argv; - path = parse_path(&path_args, pg->ps, ti); + path = parse_path(&path_args, &pg->ps, ti); if (!path) goto bad; @@ -524,7 +515,7 @@ m = path->pg->m; path->has_failed = 1; - path->pg->ps->type->fail_path(path->pg->ps, path); + path->pg->ps.type->fail_path(&path->pg->ps, path); schedule_work(&m->trigger_event); spin_lock(&m->lock); @@ -609,14 +600,14 @@ DMEMIT("%u ", m->nr_priority_groups); list_for_each_entry(pg, &m->priority_groups, list) { - DMEMIT("%u %u ", pg->nr_paths, pg->ps->type->info_args); + DMEMIT("%u %u ", pg->nr_paths, pg->ps.type->info_args); list_for_each_entry(p, &pg->paths, list) { format_dev_t(buffer, p->dev->bdev->bd_dev); spin_lock_irqsave(&p->failed_lock, flags); DMEMIT("%s %s %u ", buffer, p->has_failed ? "F" : "A", p->fail_count); - pg->ps->type->status(pg->ps, p, type, + pg->ps.type->status(&pg->ps, p, type, result + sz, maxlen - sz); spin_unlock_irqrestore(&p->failed_lock, flags); } @@ -627,13 +618,13 @@ DMEMIT("%u ", m->nr_priority_groups); list_for_each_entry(pg, &m->priority_groups, list) { - DMEMIT("%s %u %u ", pg->ps->type->name, - pg->nr_paths, pg->ps->type->table_args); + DMEMIT("%s %u %u ", pg->ps.type->name, + pg->nr_paths, pg->ps.type->table_args); list_for_each_entry(p, &pg->paths, list) { format_dev_t(buffer, p->dev->bdev->bd_dev); DMEMIT("%s ", buffer); - pg->ps->type->status(pg->ps, p, type, + pg->ps.type->status(&pg->ps, p, type, result + sz, maxlen - sz); } --- diff/drivers/md/dm-path-selector.c 2004-09-28 15:42:45.000000000 +0100 +++ source/drivers/md/dm-path-selector.c 2004-09-28 15:46:19.000000000 +0100 @@ -27,11 +27,11 @@ struct path_selector_type *__find_path_selector_type(const char *name) { - struct ps_internal *li; + struct ps_internal *psi; - list_for_each_entry (li, &_path_selectors, list) { - if (!strcmp(name, li->pst.name)) - return &li->pst; + list_for_each_entry (psi, &_path_selectors, list) { + if (!strcmp(name, psi->pst.name)) + return &psi->pst; } return NULL; @@ -77,13 +77,13 @@ up(&_lock); } -static struct ps_internal *_alloc_path_selector(struct path_selector_type *pt) +static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst) { struct ps_internal *psi = kmalloc(sizeof(*psi), GFP_KERNEL); if (psi) { memset(psi, 0, sizeof(*psi)); - memcpy(&psi->pst, pt, sizeof(*pt)); + memcpy(&psi->pst, pst, sizeof(*pst)); } return psi;