extern int select_prio (struct path * pp) { struct mpentry * mpe; struct prio * p = &pp->prio; if (pp->detect_prio == DETECT_PRIO_ON) { detect_prio(pp); if (prio_selected(p)) { condlog(3, "%s: prio = %s (detected setting)", pp->dev, prio_name(p)); return 0; } } if ((mpe = find_mpe(pp->wwid))) { if (mpe->prio_name) { prio_get(p, mpe->prio_name, mpe->prio_args); condlog(3, "%s: prio = %s (LUN setting)", pp->dev, prio_name(p)); return 0; } } if (pp->hwe && pp->hwe->prio_name) { prio_get(p, pp->hwe->prio_name, pp->hwe->prio_args); condlog(3, "%s: prio = %s (controller setting)", pp->dev, pp->hwe->prio_name); condlog(3, "%s: prio args = %s (controller setting)", pp->dev, pp->hwe->prio_args); return 0; } if (conf->prio_name) { prio_get(p, conf->prio_name, conf->prio_args); condlog(3, "%s: prio = %s (config file default)", pp->dev, conf->prio_name); condlog(3, "%s: prio args = %s (config file default)", pp->dev, conf->prio_args); return 0; } prio_get(p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS); condlog(3, "%s: prio = %s (internal default)", pp->dev, DEFAULT_PRIO); condlog(3, "%s: prio = %s (internal default)", pp->dev, DEFAULT_PRIO_ARGS); return 0; }
int select_prio(struct config *conf, struct path *pp) { char *origin; struct mpentry * mpe; struct prio * p = &pp->prio; if (pp->detect_prio == DETECT_PRIO_ON) { detect_prio(conf, pp); if (prio_selected(p)) { origin = "(setting: array autodetected)"; goto out; } } mpe = find_mpe(conf->mptable, pp->wwid); set_prio(conf->multipath_dir, mpe, "(setting: multipath.conf multipaths section)"); set_prio(conf->multipath_dir, conf->overrides, "(setting: multipath.conf overrides section)"); set_prio(conf->multipath_dir, pp->hwe, "(setting: array configuration)"); set_prio(conf->multipath_dir, conf, "(setting: multipath.conf defaults/devices section)"); prio_get(conf->multipath_dir, p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS); origin = "(setting: multipath internal)"; out: /* * fetch tpgs mode for alua, if its not already obtained */ if (!strncmp(prio_name(p), PRIO_ALUA, PRIO_NAME_LEN)) { int tpgs = 0; unsigned int timeout = conf->checker_timeout; if(!pp->tpgs && (tpgs = get_target_port_group_support(pp->fd, timeout)) >= 0) pp->tpgs = tpgs; } condlog(3, "%s: prio = %s %s", pp->dev, prio_name(p), origin); condlog(3, "%s: prio args = \"%s\" %s", pp->dev, prio_args(p), origin); return 0; }