Skip to contentSkip to conversation

fs: dlm: remove unused count_match variable

PATCH In review Tom Rix 2 participants 2 messages Mar 30, 2023 – Apr 7, 2023 Distributed lock manager (DLM)

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 fs: dlm: remove unused count_match variable

clang with W=1 reports
fs/dlm/dir.c:67:26: error: variable
'count_match' set but not used [-Werror,-Wunused-but-set-variable]

        unsigned int count = 0, count_match = 0, count_bad = 0, count_add = 0;
                                ^

This variable is not used so remove it.

---
 fs/dlm/dir.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
fs/dlm/dir.c +1 -9
index fb1981654bb2..982f7a5570fe 100644
@@ -64,7 +64,7 @@ int dlm_recover_directory(struct dlm_ls *ls)
 	char *b, *last_name = NULL;
 	int error = -ENOMEM, last_len, nodeid, result;
 	uint16_t namelen;
-	unsigned int count = 0, count_match = 0, count_bad = 0, count_add = 0;
+	unsigned int count = 0, count_bad = 0, count_add = 0;
 
 	log_rinfo(ls, "dlm_recover_directory");
 
@@ -158,14 +158,6 @@ int dlm_recover_directory(struct dlm_ls *ls)
 							     b, namelen);
 				}
 
-				/* The name was found in rsbtbl, and the
-				 * master nodeid matches memb->nodeid. */
-
-				if (result == DLM_LU_MATCH &&
-				    nodeid == memb->nodeid) {
-					count_match++;
-				}
-
 				/* The name was not found in rsbtbl and was
 				 * added with memb->nodeid as the master. */
 
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · On Thu, Mar 30, 2023 at 6:21?AM Tom Rix <[email protected]> wrote:

clang with W=1 reports
fs/dlm/dir.c:67:26: error: variable
'count_match' set but not used [-Werror,-Wunused-but-set-variable]

        unsigned int count = 0, count_match = 0, count_bad = 0, count_add = 0;
                                ^

This variable is not used so remove it.

Fixes commit c04fecb4d9f7 ("dlm: use rsbtbl as resource directory")

I can't help but wonder what this logic originally intended, but this was introduced back in 2012, so guessing no one cares/remembers/hits related issues.

The condition above is
149 if (result == DLM_LU_MATCH &&
150 nodeid != memb->nodeid) {

which looks like the condition you removed could have been folded into that originally:

if (result == DLM_LU_MATCH) {
if (nodeid == memb->nodeid)

    ++count_match;
  else {
    ...
Quoted 35 lines
---
 fs/dlm/dir.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
fs/dlm/dir.c +1 -10
index fb1981654bb2..982f7a5570fe 100644
@@ -64,7 +64,7 @@ int dlm_recover_directory(struct dlm_ls *ls)
        char *b, *last_name = NULL;
        int error = -ENOMEM, last_len, nodeid, result;
        uint16_t namelen;
-       unsigned int count = 0, count_match = 0, count_bad = 0, count_add = 0;
+       unsigned int count = 0, count_bad = 0, count_add = 0;
 
        log_rinfo(ls, "dlm_recover_directory");
 
@@ -158,14 +158,6 @@ int dlm_recover_directory(struct dlm_ls *ls)
                                                             b, namelen);
                                }
 
-                               /* The name was found in rsbtbl, and the
-                                * master nodeid matches memb->nodeid. */
-
-                               if (result == DLM_LU_MATCH &&
-                                   nodeid == memb->nodeid) {
-                                       count_match++;
-                               }
-
                                /* The name was not found in rsbtbl and was
                                 * added with memb->nodeid as the master. */
 
--

2.27.0

Signature · 2 lines
Thanks,
~Nick Desaulniers