linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Jonathan Corbet <corbet@lwn.net>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Hao Li <lihao2018.fnst@cn.fujitsu.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] fs/dcache: avoid unused-function warning
Date: Fri,  3 Dec 2021 20:01:02 +0100	[thread overview]
Message-ID: <20211203190123.874239-2-arnd@kernel.org> (raw)
In-Reply-To: <20211203190123.874239-1-arnd@kernel.org>

From: Arnd Bergmann <arnd@arndb.de>

Now that 'dentry_stat' is marked 'static', we can run into this warning:

fs/dcache.c:128:29: error: 'dentry_stat' defined but not used [-Werror=unused-variable]
  128 | static struct dentry_stat_t dentry_stat = {

Hide it in the same #ifdef as its only references.

Fixes: f0eea17ca8da ("fs: move dcache sysctls to its own file")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/dcache.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 0eef1102f460..c84269c6e8bf 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -124,16 +124,15 @@ struct dentry_stat_t {
 	long dummy;		/* Reserved for future use */
 };
 
-/* Statistics gathering. */
-static struct dentry_stat_t dentry_stat = {
-	.age_limit = 45,
-};
-
 static DEFINE_PER_CPU(long, nr_dentry);
 static DEFINE_PER_CPU(long, nr_dentry_unused);
 static DEFINE_PER_CPU(long, nr_dentry_negative);
 
 #if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS)
+/* Statistics gathering. */
+static struct dentry_stat_t dentry_stat = {
+	.age_limit = 45,
+};
 
 /*
  * Here we resort to our own counters instead of using generic per-cpu counters
-- 
2.29.2


  reply	other threads:[~2021-12-03 19:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 19:01 [PATCH 1/2] fs/inode: avoid unused-variable warning Arnd Bergmann
2021-12-03 19:01 ` Arnd Bergmann [this message]
2021-12-04 11:57   ` [PATCH 2/2] fs/dcache: avoid unused-function warning Christian Brauner
2021-12-04 11:56 ` [PATCH 1/2] fs/inode: avoid unused-variable warning Christian Brauner

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=20211203190123.874239-2-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=corbet@lwn.net \
    --cc=lihao2018.fnst@cn.fujitsu.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --cc=viro@zeniv.linux.org.uk \
    /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 NNTP newsgroup(s).