From patchwork Fri Dec 3 19:01:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 12655653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB9F0C433F5 for ; Fri, 3 Dec 2021 19:01:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241720AbhLCTFC (ORCPT ); Fri, 3 Dec 2021 14:05:02 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:43200 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243519AbhLCTE5 (ORCPT ); Fri, 3 Dec 2021 14:04:57 -0500 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 sin.source.kernel.org (Postfix) with ESMTPS id A7A6FCE281F; Fri, 3 Dec 2021 19:01:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF6A4C53FAD; Fri, 3 Dec 2021 19:01:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638558089; bh=GXmPIgE0ZwJRB34/l3vEoqjm/LJssxrqvmuSzxhl6T4=; h=From:To:Cc:Subject:Date:From; b=GI6w2zd6ydzo8kmQeVrUOX7aiHrQN9WKYxJJrnc3NnRdEzR2q6BkrsR4Iqsgc/fj2 Ew5ZsQMrr9j6MeXOvRdE0LteRod2CrCJckKHVLbT7gAtdM82Ty6saH+SdublBYAU7z paHkUYvQ3mhnpEGd3LeBmzSoudtrCHZs/zMxiDMXEPIkK5G73vPxA8Zeq/9aaphzXT tswtpWnMZwSYWdS8HbeJZ11t2TUMvzyf7/nJbdAtmBF0ZSnPjuGV6FMy72IoIZKAg0 BL9WjC07vYVzSsn8UuDvqtYSZCFCYrPy2qpLfIUB14WMq7TDmBu5C3tmqvIYy2JpNE HnqIQw3yOAz+A== From: Arnd Bergmann 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@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] fs/inode: avoid unused-variable warning Date: Fri, 3 Dec 2021 20:01:01 +0100 Message-Id: <20211203190123.874239-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Arnd Bergmann 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 Acked-by: Christian Brauner --- 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) { From patchwork Fri Dec 3 19:01:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 12655655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F5F5C433F5 for ; Fri, 3 Dec 2021 19:01:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343515AbhLCTFG (ORCPT ); Fri, 3 Dec 2021 14:05:06 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:43312 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243519AbhLCTFF (ORCPT ); Fri, 3 Dec 2021 14:05:05 -0500 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 sin.source.kernel.org (Postfix) with ESMTPS id 26EE5CE281E; Fri, 3 Dec 2021 19:01:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD4BEC53FCD; Fri, 3 Dec 2021 19:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638558098; bh=qhIqzvUuq7x/CDXgiR+YK9vTB/venL5eiKQkZSnYM4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kJl9sArEjy2oeAV/PGgVpQ3PDQ+MwLOFnwS7uw4wDcqY3Hh6JtR5ePUyFPFKyK/hK NrWpZPI0ZVW4tDRhAEHxkrHCS2lGSYWCjUuTlM+Qmqwim1DJZonDHcRxet9UneTfMD +hEBNlRQeBDkF6k6Aw27kZcE9XtMkU7yesmVjWAotAetOxVEQfGv8X6UASWdobEuf5 pSDHa2r2J1H5HtUAvz6yi2+/ARXYlv3I/FpHQGmlppquQ2vom7H5hreE3XSSIiRCYY 0a9f5XT9sqGZM8MJz9eu+xyqa/NpX/j2eqxuEPz3mv5o5FpjMNrK0MV6K/DLlksSKO F+6e+1TXVx0wg== From: Arnd Bergmann To: Alexander Viro , Luis Chamberlain , Stephen Rothwell , Andrew Morton Cc: Arnd Bergmann , Jonathan Corbet , Mauro Carvalho Chehab , Hao Li , Randy Dunlap , 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 Message-Id: <20211203190123.874239-2-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211203190123.874239-1-arnd@kernel.org> References: <20211203190123.874239-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Arnd Bergmann 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 Acked-by: Christian Brauner --- 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