linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] fs/inode: avoid unused-variable warning
@ 2021-12-03 19:01 Arnd Bergmann
  2021-12-03 19:01 ` [PATCH 2/2] fs/dcache: avoid unused-function warning Arnd Bergmann
  2021-12-04 11:56 ` [PATCH 1/2] fs/inode: avoid unused-variable warning Christian Brauner
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2021-12-03 19:01 UTC (permalink / raw)
  To: Alexander Viro, Luis Chamberlain, Stephen Rothwell, Andrew Morton
  Cc: Arnd Bergmann, Christian Brauner, Jan Kara, James Morris,
	Johannes Weiner, Matthew Wilcox (Oracle),
	Eric Biggers, Miklos Szeredi, linux-fsdevel, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

Now that 'inodes_stat' is marked 'static', it causes a harmless warning
whenever it is unused:

fs/inode.c:73:29: error: 'inodes_stat' defined but not used [-Werror=unused-variable]
   73 | static struct inodes_stat_t inodes_stat;

Move it into the #ifdef that guards its only references.

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

diff --git a/fs/inode.c b/fs/inode.c
index bef6ba9b8eb4..63324df6fa27 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -67,11 +67,6 @@ const struct address_space_operations empty_aops = {
 };
 EXPORT_SYMBOL(empty_aops);
 
-/*
- * Statistics gathering..
- */
-static struct inodes_stat_t inodes_stat;
-
 static DEFINE_PER_CPU(unsigned long, nr_inodes);
 static DEFINE_PER_CPU(unsigned long, nr_unused);
 
@@ -106,6 +101,11 @@ long get_nr_dirty_inodes(void)
  * Handle nr_inode sysctl
  */
 #ifdef CONFIG_SYSCTL
+/*
+ * Statistics gathering..
+ */
+static struct inodes_stat_t inodes_stat;
+
 static int proc_nr_inodes(struct ctl_table *table, int write, void *buffer,
 			  size_t *lenp, loff_t *ppos)
 {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] fs/dcache: avoid unused-function warning
  2021-12-03 19:01 [PATCH 1/2] fs/inode: avoid unused-variable warning Arnd Bergmann
@ 2021-12-03 19:01 ` Arnd Bergmann
  2021-12-04 11:57   ` Christian Brauner
  2021-12-04 11:56 ` [PATCH 1/2] fs/inode: avoid unused-variable warning Christian Brauner
  1 sibling, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2021-12-03 19:01 UTC (permalink / raw)
  To: Alexander Viro, Luis Chamberlain, Stephen Rothwell, Andrew Morton
  Cc: Arnd Bergmann, Jonathan Corbet, Mauro Carvalho Chehab, Hao Li,
	Randy Dunlap, linux-fsdevel, linux-kernel

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] fs/inode: avoid unused-variable warning
  2021-12-03 19:01 [PATCH 1/2] fs/inode: avoid unused-variable warning Arnd Bergmann
  2021-12-03 19:01 ` [PATCH 2/2] fs/dcache: avoid unused-function warning Arnd Bergmann
@ 2021-12-04 11:56 ` Christian Brauner
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2021-12-04 11:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alexander Viro, Luis Chamberlain, Stephen Rothwell,
	Andrew Morton, Arnd Bergmann, Jan Kara, James Morris,
	Johannes Weiner, Matthew Wilcox (Oracle),
	Eric Biggers, Miklos Szeredi, linux-fsdevel, linux-kernel

On Fri, Dec 03, 2021 at 08:01:01PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Now that 'inodes_stat' is marked 'static', it causes a harmless warning
> whenever it is unused:
> 
> fs/inode.c:73:29: error: 'inodes_stat' defined but not used [-Werror=unused-variable]
>    73 | static struct inodes_stat_t inodes_stat;
> 
> Move it into the #ifdef that guards its only references.
> 
> Fixes: 245314851782 ("fs: move inode sysctls to its own file")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Looks good.
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] fs/dcache: avoid unused-function warning
  2021-12-03 19:01 ` [PATCH 2/2] fs/dcache: avoid unused-function warning Arnd Bergmann
@ 2021-12-04 11:57   ` Christian Brauner
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2021-12-04 11:57 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alexander Viro, Luis Chamberlain, Stephen Rothwell,
	Andrew Morton, Arnd Bergmann, Jonathan Corbet,
	Mauro Carvalho Chehab, Hao Li, Randy Dunlap, linux-fsdevel,
	linux-kernel

On Fri, Dec 03, 2021 at 08:01:02PM +0100, Arnd Bergmann wrote:
> 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>
> ---

Looks good.
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-04 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 19:01 [PATCH 1/2] fs/inode: avoid unused-variable warning Arnd Bergmann
2021-12-03 19:01 ` [PATCH 2/2] fs/dcache: avoid unused-function warning Arnd Bergmann
2021-12-04 11:57   ` Christian Brauner
2021-12-04 11:56 ` [PATCH 1/2] fs/inode: avoid unused-variable warning Christian Brauner

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).