From: Christophe Varoqui Date: Wed, 16 Nov 2005 15:26:10 +0000 (+0100) Subject: [libmultipath] don't re-select the getprio fn when not needed X-Git-Tag: 0.4.7~136 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45d19bedd2793f0a3fd400a7742f3577cf466a74;p=platform%2Fupstream%2Fmultipath-tools.git [libmultipath] don't re-select the getprio fn when not needed The pp->getprio was used 1) to store the prioritizer function pointer 2) to determine if the prioritizer was already selected But NULL is a valid value for already selected getprio. Which causes uneeded re-selection. So introduce a pp->getprio_selected flag to straight this out. Edward Goggin, EMC --- diff --git a/libmultipath/cache.c b/libmultipath/cache.c index d646bc7..a90b617 100644 --- a/libmultipath/cache.c +++ b/libmultipath/cache.c @@ -21,6 +21,7 @@ revoke_cache_info(struct path * pp) pp->getuid = NULL; pp->getprio = NULL; pp->checkfn = NULL; + pp->getprio_selected = 0; } int diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index a1b7a09..41ad512 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -629,9 +629,10 @@ pathinfo (struct path *pp, vector hwtable, int mask) * get path prio */ if (mask & DI_PRIO) { - if (!pp->getprio) + if (!pp->getprio_selected) { select_getprio(pp); - + pp->getprio_selected = 1; + } if (!pp->getprio) { pp->priority = 1; } else if (apply_format(pp->getprio, &buff[0], pp)) { diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 183e790..3bcb5b9 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -99,6 +99,7 @@ struct path { int pgindex; char * getuid; char * getprio; + int getprio_selected; int (*checkfn) (int, char *, void **); void * checker_context; struct multipath * mpp; diff --git a/multipathd/main.c b/multipathd/main.c index af3fabc..e1130f0 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -168,6 +168,7 @@ orphan_path (struct path * pp) pp->checker_context = NULL; pp->getuid = NULL; pp->getprio = NULL; + pp->getprio_selected = 0; if (pp->fd >= 0) close(pp->fd);