From patchwork Tue Mar 28 12:22:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 76031 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2178740vqo; Tue, 28 Mar 2023 05:32:15 -0700 (PDT) X-Google-Smtp-Source: AKy350aslRL+fNxA8WSGulSDMXqi4UjOWRp6RGZ0FAW8cw3yVhRl8ZDA2MH8ZmW3t5pDXceLgmMy X-Received: by 2002:a17:90b:4a8b:b0:23f:1165:b49f with SMTP id lp11-20020a17090b4a8b00b0023f1165b49fmr14866598pjb.38.1680006735058; Tue, 28 Mar 2023 05:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680006735; cv=none; d=google.com; s=arc-20160816; b=Ez963Zld/rE13B+sxP7Wgwsd6vmM6D1d7Bxs6tlW0Hb5VsbD5B5hwiHA43GtUaLi5R ehYqllForPs04K6JXTQfsm3aGXWE30epvugps9PeyggHA8JZqB+RAON693idf1DpP8RH LRiTZ3yo/74kgfEQpNQnrrkk1KiUfyjMMEKP/s9ScBqUAnV03fieXhwp115130TK5BjM CA3U3FWd/oIkkL7Zz1utfgvebJe0MN72cMPXpXjDmnOjTtu/IBwxxO//cSEYOp7H3N8x acki/53oRrliQOhXWzY+znKgAoAbDeiWSsDe2IQ0DLbFiEoxv9nrnG+MWx/XqE+fGFm3 DLAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UUdwIoEtUZSf78246kN13j0gUfk8QAm/gudiPKWnRWg=; b=sdGvZjcRQ+p14JkKAVCRT4SV+oIffJEEoVfbKmUlPzxc9l2bGzAWbzPESHikgt6xSk xRPX68+6HSkiQ3Mtzrq2WDyGyv+j2YURQRraPeEiAF2qSHO15pbIrJ3EpkvQUxHKSWlh InBcN8agkGhUGjEQcztLYKPM4X3/N9SQ4bDP/6UzjQt/T7W7CLe+C/DlwUnr4H+PqKBs fL2cfNB22rduxq3SFE2++WEIL2o1AofCUkyCDUf812qRkqK350deyFXI9pXIJqmetKVi hLR1KnbChVvPOahyOtRpvVrbecayOto1apX4iZc+KyDfbk9Lg4Mfqyd3DvKmrGfzuYEF 2zQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FwXsEXEK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 65-20020a630244000000b0051323b8a185si10400858pgc.811.2023.03.28.05.32.01; Tue, 28 Mar 2023 05:32:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FwXsEXEK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231929AbjC1MWz (ORCPT + 99 others); Tue, 28 Mar 2023 08:22:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbjC1MWx (ORCPT ); Tue, 28 Mar 2023 08:22:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB5F3F5 for ; Tue, 28 Mar 2023 05:22:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7931AB81CA5 for ; Tue, 28 Mar 2023 12:22:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE77BC433D2; Tue, 28 Mar 2023 12:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680006170; bh=SrusFfYKuzb9qJ1fPuyyiI19ee9dDYsDkKxhBfXFx60=; h=From:To:Cc:Subject:Date:From; b=FwXsEXEKogNnEjhyVpejwrEZ8M64Nhw0cflqOr9Hmq6LC/yls6YXwaSpuQ0P5tr6Q AP3JT+IbBllwzb35HlxZZ9FQ1rTezdgMnd0wdKLFbARifI9LgkrXRB6qEqnMMPyxk3 zP6MBisI4s1Ty6JEt1spwm2NkTTeAii0zZV2qG0IrJBuAJ7BEr0P8qMnXURz5lLizr b2ZUPRedrt6HC3RWrotpNbK5RjpLXR0GS5uceaC9cfElhah/u2ueUU3Ce0dGVcbAdp DjyKxE8oTOqWoyJpfI+Ng50JkoUlX7u3caqQtofmtt9bm9YCnb0NIRa4wfCbF0eGkD REoTjHud0n/vg== From: Arnd Bergmann To: Jan Kara , Yangtao Li Cc: Arnd Bergmann , Christian Brauner , Seth Forshee , Dave Chinner , Roman Gushchin , Baokun Li , "Matthew Wilcox (Oracle)" , Luis Chamberlain , 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 Message-Id: <20230328122244.2521387-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761614742481105667?= X-GMAIL-MSGID: =?utf-8?q?1761614742481105667?= From: Arnd Bergmann 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 --- 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,