From: Arnd Bergmann <arnd@kernel.org>
To: Jan Kara <jack@suse.com>, Yangtao Li <frank.li@vivo.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Christian Brauner <brauner@kernel.org>,
Seth Forshee <sforshee@digitalocean.com>,
Dave Chinner <dchinner@redhat.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Baokun Li <libaokun1@huawei.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Luis Chamberlain <mcgrof@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] fs: quota: avoid unused function warning for !CONFIG_SYSCTL
Date: Tue, 28 Mar 2023 14:22:31 +0200 [thread overview]
Message-ID: <20230328122244.2521387-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
Having fs_dqstats_table[] inside of an #ifdef causes a build time
warning:
fs/quota/dquot.c:2864:12: error: 'do_proc_dqstats' defined but not used [-Werror=unused-function]
2864 | static int do_proc_dqstats(struct ctl_table *table, int write,
Avoid this by using an IS_ENABLED() check in place of the #ifdef,
giving the compiler a better idea of how it is used.
Fixes: 63d00e08515b ("quota: check for register_sysctl() failure")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Note: it may be better to just revert the 63d00e08515b patch, as the
additional pr_notice() does not seem to add much value after
the pr_err() printed by register_sysctl() that tells us exactly what
went wrong.
---
fs/quota/dquot.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 05bed02b257f..6e9109c6218e 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2877,7 +2877,6 @@ static int do_proc_dqstats(struct ctl_table *table, int write,
return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
}
-#ifdef CONFIG_SYSCTL
static struct ctl_table fs_dqstats_table[] = {
{
.procname = "lookups",
@@ -2946,7 +2945,6 @@ static struct ctl_table fs_dqstats_table[] = {
#endif
{ },
};
-#endif
static int __init dquot_init(void)
{
@@ -2955,10 +2953,10 @@ static int __init dquot_init(void)
printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__);
-#ifdef CONFIG_SYSCTL
- if (!register_sysctl("fs/quota", fs_dqstats_table))
- pr_notice("quota sysctl registration failed!\n");
-#endif
+ if (IS_ENABLED(CONFIG_SYSCTL)) {
+ if (!register_sysctl("fs/quota", fs_dqstats_table))
+ pr_notice("quota sysctl registration failed!\n");
+ }
dquot_cachep = kmem_cache_create("dquot",
sizeof(struct dquot), sizeof(unsigned long) * 4,
--
2.39.2
next reply other threads:[~2023-03-28 12:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-28 12:22 Arnd Bergmann [this message]
2023-03-28 17:48 ` [PATCH] fs: quota: avoid unused function warning for !CONFIG_SYSCTL Luis Chamberlain
2023-03-29 9:44 ` Jan Kara
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=20230328122244.2521387-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=brauner@kernel.org \
--cc=dchinner@redhat.com \
--cc=frank.li@vivo.com \
--cc=jack@suse.com \
--cc=libaokun1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=roman.gushchin@linux.dev \
--cc=sforshee@digitalocean.com \
--cc=willy@infradead.org \
/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