[dm-devel] [PATCH v3 7/7] multipathd: only grab conf once for filter_path()
Martin Wilck
mwilck at suse.com
Fri Nov 2 12:24:02 UTC 2018
This saves a possibly large number of cleanup push/pop calls and
slightly improves readability.
Reviewed-by: Benjamin Marzinski <bmarzins at redhat.com>
Signed-off-by: Martin Wilck <mwilck at suse.com>
---
multipathd/main.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 3cccc9f8..a445b050 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2340,16 +2340,17 @@ configure (struct vectors * vecs)
goto fail;
}
+ conf = get_multipath_config();
+ pthread_cleanup_push(put_multipath_config, conf);
vector_foreach_slot (vecs->pathvec, pp, i){
- conf = get_multipath_config();
- pthread_cleanup_push(put_multipath_config, conf);
if (filter_path(conf, pp) > 0){
vector_del_slot(vecs->pathvec, i);
free_path(pp);
i--;
}
- pthread_cleanup_pop(1);
}
+ pthread_cleanup_pop(1);
+
if (map_discovery(vecs)) {
condlog(0, "configure failed at map discovery");
goto fail;
--
2.19.1
More information about the dm-devel
mailing list