free_multipath() is now always called with free_paths == KEEP_PATHS. Remove the argument and the code for freeing paths.
Suggested-by: Benjamin Marzinski <[email protected]> Signed-off-by: Martin Wilck <[email protected]> --- libmultipath/devmapper.c | 2 +- libmultipath/structs.c | 26 +++++--------------------- libmultipath/structs.h | 2 +- libmultipath/structs_vec.c | 2 +- multipath/main.c | 2 +- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 8e632ba..e3870f5 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1279,7 +1279,7 @@ int dm_get_maps(vector mp) switch (dm_get_multipath(names->name, &mpp)) { case DMP_OK: if (!vector_alloc_slot(mp)) { - free_multipath(mpp, KEEP_PATHS); + free_multipath(mpp); return 1; } vector_set_slot(mp, mpp); diff --git a/libmultipath/structs.c b/libmultipath/structs.c index ec8779c..9e1734d 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -296,8 +296,7 @@ void free_multipath_attributes(struct multipath *mpp) } } -void -free_multipath (struct multipath * mpp, enum free_path_mode free_paths) +void free_multipath(struct multipath *mpp) { if (!mpp) return; @@ -309,22 +308,7 @@ free_multipath (struct multipath * mpp, enum free_path_mode free_paths) mpp->alias = NULL; } - if (!free_paths && mpp->pg) { - struct pathgroup *pgp; - struct path *pp; - int i, j; - - /* - * Make sure paths carry no reference to this mpp any more - */ - vector_foreach_slot(mpp->pg, pgp, i) { - vector_foreach_slot(pgp->paths, pp, j) - if (pp->mpp == mpp) - pp->mpp = NULL; - } - } - - free_pathvec(mpp->paths, free_paths); + free_pathvec(mpp->paths, KEEP_PATHS); free_pgvec(mpp->pg); if (mpp->hwe) { vector_free(mpp->hwe); @@ -337,13 +321,13 @@ free_multipath (struct multipath * mpp, enum free_path_mode free_paths) void cleanup_multipath(struct multipath **pmpp) { if (*pmpp) - free_multipath(*pmpp, KEEP_PATHS); + free_multipath(*pmpp); } void cleanup_multipath_and_paths(struct multipath **pmpp) { if (*pmpp) - free_multipath(*pmpp, FREE_PATHS); + free_multipath(*pmpp); } void free_multipathvec(vector mpvec) @@ -355,7 +339,7 @@ void free_multipathvec(vector mpvec) return; vector_foreach_slot (mpvec, mpp, i) - free_multipath(mpp, KEEP_PATHS); + free_multipath(mpp); vector_free(mpvec); } diff --git a/libmultipath/structs.h b/libmultipath/structs.h index b16bd9e..a637af7 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -580,7 +580,7 @@ void free_pathvec (vector vec, enum free_path_mode free_paths); void cleanup_pathvec_and_free_paths(vector *vec); void free_pathgroup(struct pathgroup *pgp); void free_pgvec(vector pgvec); -void free_multipath (struct multipath *, enum free_path_mode free_paths); +void free_multipath(struct multipath *mpp); void cleanup_multipath(struct multipath **pmpp); void cleanup_multipath_and_paths(struct multipath **pmpp); void free_multipath_attributes(struct multipath *); diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 8d9c0be..62ee450 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -432,7 +432,7 @@ void remove_map(struct multipath *mpp, vector pathvec) */ orphan_paths(pathvec, mpp, "map removed internally"); - free_multipath(mpp, KEEP_PATHS); + free_multipath(mpp); } void diff --git a/multipath/main.c b/multipath/main.c index d28628b..5557732 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -1069,7 +1069,7 @@ main (int argc, char *argv[]) printf("successfully reset wwids\n"); vector_foreach_slot_backwards(curmp, mpp, i) { vector_del_slot(curmp, i); - free_multipath(mpp, KEEP_PATHS); + free_multipath(mpp); } vector_free(curmp); goto out; -- 2.52.0
