From: Nick Desaulniers <ndesaulniers@google.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] fs: dlm: remove unused count_match variable
Date: Fri, 7 Apr 2023 11:08:24 -0700 [thread overview]
Message-ID: <CAKwvOdkim2tY3VvR_ejCuzVivEH3iadZYFE_dnMS1shXfJ5eUA@mail.gmail.com> (raw)
In-Reply-To: <20230330132114.1826399-1-trix@redhat.com>
On Thu, Mar 30, 2023 at 6:21?AM Tom Rix <trix@redhat.com> 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.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
Fixes: commit c04fecb4d9f7 ("dlm: use rsbtbl as resource directory")
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
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 {
...
> ---
> fs/dlm/dir.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c
> index fb1981654bb2..982f7a5570fe 100644
> --- a/fs/dlm/dir.c
> +++ b/fs/dlm/dir.c
> @@ -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
>
--
Thanks,
~Nick Desaulniers
prev parent reply other threads:[~2023-04-07 18:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 13:21 [Cluster-devel] [PATCH] fs: dlm: remove unused count_match variable Tom Rix
2023-04-07 18:08 ` Nick Desaulniers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKwvOdkim2tY3VvR_ejCuzVivEH3iadZYFE_dnMS1shXfJ5eUA@mail.gmail.com \
--to=ndesaulniers@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).