]>
Commit | Line | Data |
---|---|---|
dc01aad8 SS |
1 | --- |
2 | libmultipath/pgpolicies.c | 23 +++++++++++++++++++---- | |
3 | 1 file changed, 19 insertions(+), 4 deletions(-) | |
4 | ||
5 | Index: multipath-tools/libmultipath/pgpolicies.c | |
6 | =================================================================== | |
7 | --- multipath-tools.orig/libmultipath/pgpolicies.c | |
8 | +++ multipath-tools/libmultipath/pgpolicies.c | |
9 | @@ -205,7 +205,8 @@ out: | |
10 | extern int | |
11 | one_path_per_group (struct multipath * mp) | |
12 | { | |
13 | - int i; | |
14 | + int i, j; | |
15 | + unsigned int prio; | |
16 | struct path * pp; | |
17 | struct pathgroup * pgp; | |
18 | ||
19 | @@ -217,16 +218,30 @@ one_path_per_group (struct multipath * m | |
20 | ||
21 | for (i = 0; i < VECTOR_SIZE(mp->paths); i++) { | |
22 | pp = VECTOR_SLOT(mp->paths, i); | |
23 | + prio = pp->priority; | |
24 | + | |
25 | + vector_foreach_slot(mp->pg, pgp, j) { | |
26 | + pp = VECTOR_SLOT(pgp->paths, 0); | |
27 | + | |
28 | + if (prio > pp->priority) | |
29 | + break; | |
30 | + } | |
31 | + | |
32 | pgp = alloc_pathgroup(); | |
33 | ||
34 | if (!pgp) | |
35 | goto out; | |
36 | ||
37 | - if (store_pathgroup(mp->pg, pgp)) | |
38 | + if (store_path(pgp->paths, VECTOR_SLOT(mp->paths, i))) | |
39 | goto out; | |
40 | ||
41 | - if (store_path(pgp->paths, pp)) | |
42 | - goto out; | |
43 | + if (j < VECTOR_SIZE(mp->pg)) { | |
44 | + if (!vector_insert_slot(mp->pg, j, pgp)) | |
45 | + goto out; | |
46 | + } else { | |
47 | + if (store_pathgroup(mp->pg, pgp)) | |
48 | + goto out; | |
49 | + } | |
50 | } | |
51 | free_pathvec(mp->paths, KEEP_PATHS); | |
52 | mp->paths = NULL; |