shift = snprintf(p, freechar, "%s %s %i %i",
mp->features, mp->hwhandler,
- VECTOR_SIZE(mp->pg), mp->nextpg);
+ VECTOR_SIZE(mp->pg), mp->bestpg);
if (shift >= freechar) {
fprintf(stderr, "mp->params too small\n");
* ponders each path group and determine highest prio pg
* to switch over (default to first)
*/
- select_path_group(mpp);
+ mpp->bestpg = select_path_group(mpp);
/*
* transform the mp->pg vector of vectors of paths
condlog(3, "set ACT_RELOAD: path group topology change");
return;
}
- if (cmpp->nextpg != mpp->nextpg) {
+ if (cmpp->nextpg != mpp->bestpg) {
mpp->action = ACT_SWITCHPG;
condlog(3, "set ACT_SWITCHPG: next path group change");
return;
return 2;
case ACT_SWITCHPG:
- dm_switchgroup(mpp->alias, mpp->nextpg);
+ dm_switchgroup(mpp->alias, mpp->bestpg);
/*
* we may have avoided reinstating paths because there where in
* active or disabled PG. Now that the topology has changed,
/*
* DM_DEVICE_CREATE or DM_DEVICE_RELOAD succeeded
*/
- dm_switchgroup(mpp->alias, mpp->nextpg);
+ dm_switchgroup(mpp->alias, mpp->bestpg);
print_mp(mpp);
}
update_paths(mpp);
if (conf->list > 1)
- select_path_group(mpp);
+ mpp->bestpg = select_path_group(mpp);
disassemble_status(mpp->status, mpp);
vector_foreach_slot (pgp->paths, pp, j)
pathinfo(pp, conf->hwtable, DI_PRIO);
- select_path_group(mpp); /* sets mpp->nextpg */
- pgp = VECTOR_SLOT(mpp->pg, mpp->nextpg - 1);
+ mpp->bestpg = select_path_group(mpp);
- if (pgp && pgp->status != PGSTATE_ACTIVE)
+ if (mpp->bestpg != mpp->nextpg)
return 1;
return 0;
static void
switch_pathgroup (struct multipath * mpp)
{
- struct pathgroup * pgp;
-
- pgp = VECTOR_SLOT(mpp->pg, mpp->nextpg - 1);
-
- if (pgp && pgp->status != PGSTATE_ACTIVE) {
- dm_switchgroup(mpp->alias, mpp->nextpg);
- condlog(2, "%s: switch to path group #%i",
- mpp->alias, mpp->nextpg);
- }
+ dm_switchgroup(mpp->alias, mpp->bestpg);
+ condlog(2, "%s: switch to path group #%i",
+ mpp->alias, mpp->bestpg);
}
static int