942c9b6ed8
Update Source to upstream version 0.8.2 * Previoud patches 0001-0017 & 0027 are included in this commit Rename files * Previous patches 0018-0026 & 0028 are not patches 0021-0030 Add 0001-libmultipath-make-vector_foreach_slot_backwards-work.patch Add 0002-libmultipath-add-marginal-paths-and-groups-infrastru.patch Add 0003-tests-add-path-grouping-policy-unit-tests.patch Add 0004-libmultipath-add-wrapper-function-around-pgpolicyfn.patch Add 0005-tests-update-pgpolicy-tests-to-work-with-group_paths.patch Add 0006-libmultipath-fix-double-free-in-pgpolicyfn-error-pat.patch Add 0007-libmultipath-consolidate-group_by_-functions.patch Add 0008-libmultipath-make-pgpolicyfn-take-a-paths-vector.patch Add 0009-libmultipath-make-group_paths-handle-marginal-paths.patch Add 0010-tests-add-tests-for-grouping-marginal-paths.patch Add 0011-libmultipath-add-marginal_pathgroups-config-option.patch Add 0012-libmutipath-deprecate-delay_-_checks.patch Add 0013-multipathd-use-marginal_pathgroups.patch Add 0014-multipath-update-man-pages.patch * The above 13 patches add the marinal_pathgroups option Add 0015-multipath.conf-add-enable_foreign-parameter.patch Add 0016-multipath.conf.5-document-foreign-library-support.patch * The above 2 patches add the enable_foreign option Add 0017-mpathpersist-remove-broken-unused-code.patch Add 0018-libmultipath-EMC-PowerMax-NVMe-device-config.patch Add 0019-mpathpersist-fix-leaks.patch Add 0020-libmultipath-fix-mpcontext-initialization.patch * The above 20 patches have been submitted upstream
175 lines
5.0 KiB
Diff
175 lines
5.0 KiB
Diff
From 1e45eb6db98185ac8917c0c8feec69b7c0226230 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Thu, 11 Jul 2019 18:13:06 -0500
|
|
Subject: [PATCH] libmultipath: make pgpolicyfn take a paths vector
|
|
|
|
To enable future changes, mp->pgpolicyfn() now takes a vector of
|
|
paths instead of always using mp->paths.
|
|
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
libmultipath/pgpolicies.c | 38 +++++++++++++++++++-------------------
|
|
libmultipath/pgpolicies.h | 10 +++++-----
|
|
libmultipath/structs.h | 2 +-
|
|
3 files changed, 25 insertions(+), 25 deletions(-)
|
|
|
|
diff --git a/libmultipath/pgpolicies.c b/libmultipath/pgpolicies.c
|
|
index 2e4db74c..2e7c0502 100644
|
|
--- a/libmultipath/pgpolicies.c
|
|
+++ b/libmultipath/pgpolicies.c
|
|
@@ -93,7 +93,7 @@ int group_paths(struct multipath *mp)
|
|
return 1;
|
|
|
|
if (VECTOR_SIZE(mp->paths) > 0 &&
|
|
- (!mp->pgpolicyfn || mp->pgpolicyfn(mp))) {
|
|
+ (!mp->pgpolicyfn || mp->pgpolicyfn(mp, mp->paths))) {
|
|
vector_free(mp->pg);
|
|
mp->pg = NULL;
|
|
return 1;
|
|
@@ -126,7 +126,7 @@ prios_match(struct path *pp1, struct path *pp2)
|
|
return (pp1->priority == pp2->priority);
|
|
}
|
|
|
|
-int group_by_match(struct multipath * mp,
|
|
+int group_by_match(struct multipath * mp, vector paths,
|
|
bool (*path_match_fn)(struct path *, struct path *))
|
|
{
|
|
int i, j;
|
|
@@ -136,17 +136,17 @@ int group_by_match(struct multipath * mp,
|
|
struct path * pp2;
|
|
|
|
/* init the bitmap */
|
|
- bitmap = (int *)MALLOC(VECTOR_SIZE(mp->paths) * sizeof (int));
|
|
+ bitmap = (int *)MALLOC(VECTOR_SIZE(paths) * sizeof (int));
|
|
|
|
if (!bitmap)
|
|
goto out;
|
|
|
|
- for (i = 0; i < VECTOR_SIZE(mp->paths); i++) {
|
|
+ for (i = 0; i < VECTOR_SIZE(paths); i++) {
|
|
|
|
if (bitmap[i])
|
|
continue;
|
|
|
|
- pp = VECTOR_SLOT(mp->paths, i);
|
|
+ pp = VECTOR_SLOT(paths, i);
|
|
|
|
/* here, we really got a new pg */
|
|
pgp = alloc_pathgroup();
|
|
@@ -163,12 +163,12 @@ int group_by_match(struct multipath * mp,
|
|
|
|
bitmap[i] = 1;
|
|
|
|
- for (j = i + 1; j < VECTOR_SIZE(mp->paths); j++) {
|
|
+ for (j = i + 1; j < VECTOR_SIZE(paths); j++) {
|
|
|
|
if (bitmap[j])
|
|
continue;
|
|
|
|
- pp2 = VECTOR_SLOT(mp->paths, j);
|
|
+ pp2 = VECTOR_SLOT(paths, j);
|
|
|
|
if (path_match_fn(pp, pp2)) {
|
|
if (store_path(pgp->paths, pp2))
|
|
@@ -193,35 +193,35 @@ out:
|
|
/*
|
|
* One path group per unique tgt_node_name present in the path vector
|
|
*/
|
|
-int group_by_node_name(struct multipath * mp)
|
|
+int group_by_node_name(struct multipath * mp, vector paths)
|
|
{
|
|
- return group_by_match(mp, node_names_match);
|
|
+ return group_by_match(mp, paths, node_names_match);
|
|
}
|
|
|
|
/*
|
|
* One path group per unique serial number present in the path vector
|
|
*/
|
|
-int group_by_serial(struct multipath * mp)
|
|
+int group_by_serial(struct multipath * mp, vector paths)
|
|
{
|
|
- return group_by_match(mp, serials_match);
|
|
+ return group_by_match(mp, paths, serials_match);
|
|
}
|
|
|
|
/*
|
|
* One path group per priority present in the path vector
|
|
*/
|
|
-int group_by_prio(struct multipath *mp)
|
|
+int group_by_prio(struct multipath *mp, vector paths)
|
|
{
|
|
- return group_by_match(mp, prios_match);
|
|
+ return group_by_match(mp, paths, prios_match);
|
|
}
|
|
|
|
-int one_path_per_group(struct multipath *mp)
|
|
+int one_path_per_group(struct multipath *mp, vector paths)
|
|
{
|
|
int i;
|
|
struct path * pp;
|
|
struct pathgroup * pgp;
|
|
|
|
- for (i = 0; i < VECTOR_SIZE(mp->paths); i++) {
|
|
- pp = VECTOR_SLOT(mp->paths, i);
|
|
+ for (i = 0; i < VECTOR_SIZE(paths); i++) {
|
|
+ pp = VECTOR_SLOT(paths, i);
|
|
pgp = alloc_pathgroup();
|
|
|
|
if (!pgp)
|
|
@@ -242,7 +242,7 @@ out:
|
|
return 1;
|
|
}
|
|
|
|
-int one_group(struct multipath *mp) /* aka multibus */
|
|
+int one_group(struct multipath *mp, vector paths) /* aka multibus */
|
|
{
|
|
int i;
|
|
struct path * pp;
|
|
@@ -256,8 +256,8 @@ int one_group(struct multipath *mp) /* aka multibus */
|
|
if (add_pathgroup(mp, pgp))
|
|
goto out1;
|
|
|
|
- for (i = 0; i < VECTOR_SIZE(mp->paths); i++) {
|
|
- pp = VECTOR_SLOT(mp->paths, i);
|
|
+ for (i = 0; i < VECTOR_SIZE(paths); i++) {
|
|
+ pp = VECTOR_SLOT(paths, i);
|
|
|
|
if (store_path(pgp->paths, pp))
|
|
goto out;
|
|
diff --git a/libmultipath/pgpolicies.h b/libmultipath/pgpolicies.h
|
|
index 11834011..7532d75f 100644
|
|
--- a/libmultipath/pgpolicies.h
|
|
+++ b/libmultipath/pgpolicies.h
|
|
@@ -25,10 +25,10 @@ int group_paths(struct multipath *);
|
|
/*
|
|
* policies
|
|
*/
|
|
-int one_path_per_group(struct multipath *);
|
|
-int one_group(struct multipath *);
|
|
-int group_by_serial(struct multipath *);
|
|
-int group_by_prio(struct multipath *);
|
|
-int group_by_node_name(struct multipath *);
|
|
+int one_path_per_group(struct multipath *, vector);
|
|
+int one_group(struct multipath *, vector);
|
|
+int group_by_serial(struct multipath *, vector);
|
|
+int group_by_prio(struct multipath *, vector);
|
|
+int group_by_node_name(struct multipath *, vector);
|
|
|
|
#endif
|
|
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
|
|
index 893074eb..a8b9d325 100644
|
|
--- a/libmultipath/structs.h
|
|
+++ b/libmultipath/structs.h
|
|
@@ -295,7 +295,7 @@ struct path {
|
|
struct gen_path generic_path;
|
|
};
|
|
|
|
-typedef int (pgpolicyfn) (struct multipath *);
|
|
+typedef int (pgpolicyfn) (struct multipath *, vector);
|
|
|
|
struct multipath {
|
|
char wwid[WWID_SIZE];
|
|
--
|
|
2.17.2
|
|
|