[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sanlock-devel
Subject:    [PATCH] reset: Use find_ls to remove lockspace by name
From:       Nir Soffer <nsoffer () redhat ! com>
Date:       2014-08-11 20:57:12
Message-ID: 1407790632-20361-1-git-send-email-nsoffer () redhat ! com
[Download RAW message or body]

find_ls was introduced recently, use it to find a lockspace by name fro
unregistering, instead of duplicating the search loop.
---
 reset/sanlk_resetd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/reset/sanlk_resetd.c b/reset/sanlk_resetd.c
index c9deedb..c9f1573 100644
--- a/reset/sanlk_resetd.c
+++ b/reset/sanlk_resetd.c
@@ -506,12 +506,12 @@ static void process_update(int fd)
 	} else if (!strcmp(cmd, "end")) {
 		log_debug("process_update end %s", name);
 
-		for (i = 0; i < MAX_LS; i++) {
-			if (!ls_names[i] || strcmp(ls_names[i], name))
-				continue;
+		i = find_ls(name);
+		if (i > -1) {
 			unregister_ls(i);
 			return;
 		}
+
 	} else if (!strcmp(cmd, "clear")) {
 		log_debug("process_update clear %s", name);
 
-- 
1.8.3.1

_______________________________________________
sanlock-devel mailing list
sanlock-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sanlock-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic