[dm-devel] [PATCH 49/54] libmultipath: get_refwwid(): get rid of "check" label

mwilck at suse.com mwilck at suse.com
Thu Jul 9 10:36:18 UTC 2020


From: Martin Wilck <mwilck at suse.com>

This was necessary with with the interspersed pthread_cleanup_push()/pop()
statements, now we can write the code more cleanly.

Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 libmultipath/configure.c | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index c4712d7..defc54b 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1449,32 +1449,23 @@ static int _get_refwwid(enum mpath_cmds cmd, char *dev, enum devtypes dev_type,
 	if (dev_type == DEV_DEVMAP) {
 
 		if (((dm_get_uuid(dev, tmpwwid, WWID_SIZE)) == 0)
-		    && (strlen(tmpwwid))) {
+		    && (strlen(tmpwwid)))
 			refwwid = tmpwwid;
-			goto check;
-		}
 
-		/*
-		 * may be a binding
-		 */
-		if (get_user_friendly_wwid(dev, tmpwwid,
-					   conf->bindings_file) == 0) {
+		/* or may be a binding */
+		else if (get_user_friendly_wwid(dev, tmpwwid,
+						conf->bindings_file) == 0)
 			refwwid = tmpwwid;
-			goto check;
-		}
 
-		/*
-		 * or may be an alias
-		 */
-		refwwid = get_mpe_wwid(conf->mptable, dev);
+		/* or may be an alias */
+		else {
+			refwwid = get_mpe_wwid(conf->mptable, dev);
 
-		/*
-		 * or directly a wwid
-		 */
-		if (!refwwid)
-			refwwid = dev;
+			/* or directly a wwid */
+			if (!refwwid)
+				refwwid = dev;
+		}
 
-check:
 		if (refwwid && strlen(refwwid) &&
 		    filter_wwid(conf->blist_wwid, conf->elist_wwid, refwwid,
 				NULL) > 0)
-- 
2.26.2





More information about the dm-devel mailing list