public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Theodore Ts'o <tytso@mit.edu>
Cc: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] ext4: silence complaint if CONFIG_QUOTA isn't set
Date: Sun, 30 Apr 2023 10:54:38 -0600	[thread overview]
Message-ID: <123c391a-2569-6afd-2461-4e5b2ca298f3@kernel.dk> (raw)

Compiling the kernel ext4 spews a warning that 'i' is unused in two
spots:

axboe@m1max ~/gi/linux-block (master)> make fs/ext4/super.o                    0.027s
  CALL    scripts/checksyscalls.sh
  CC      fs/ext4/super.o
fs/ext4/super.c: In function ?ext4_put_super?:
fs/ext4/super.c:1262:13: warning: unused variable ?i? [-Wunused-variable]
  1262 |         int i, err;
       |             ^
fs/ext4/super.c: In function ?__ext4_fill_super?:
fs/ext4/super.c:5200:22: warning: unused variable ?i? [-Wunused-variable]
  5200 |         unsigned int i;
       |                      ^

Put the quota freeing code into a helper so we can stub it out for
!CONFIG_QUOTA.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---

This appears new, but I didn't check what commit potentially broke
this...

 fs/ext4/super.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d03bf0ecf505..5d85d7377d84 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1254,12 +1254,23 @@ static void ext4_flex_groups_free(struct ext4_sb_info *sbi)
 	rcu_read_unlock();
 }
 
+static void ext4_free_quotas(struct super_block *sb,
+			     struct ext4_sb_info *sbi)
+{
+#ifdef CONFIG_QUOTA
+	unsigned int i;
+
+	for (i = 0; i < EXT4_MAXQUOTAS; i++)
+		kfree(get_qf_name(sb, sbi, i));
+#endif
+}
+
 static void ext4_put_super(struct super_block *sb)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct ext4_super_block *es = sbi->s_es;
 	int aborted = 0;
-	int i, err;
+	int err;
 
 	/*
 	 * Unregister sysfs before destroying jbd2 journal.
@@ -1310,10 +1321,7 @@ static void ext4_put_super(struct super_block *sb)
 	ext4_group_desc_free(sbi);
 	ext4_flex_groups_free(sbi);
 	ext4_percpu_param_destroy(sbi);
-#ifdef CONFIG_QUOTA
-	for (i = 0; i < EXT4_MAXQUOTAS; i++)
-		kfree(get_qf_name(sb, sbi, i));
-#endif
+	ext4_free_quotas(sb, sbi);
 
 	/* Debugging code just in case the in-memory inode orphan list
 	 * isn't empty.  The on-disk one can be non-empty if we've
@@ -5197,7 +5205,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
 	ext4_fsblk_t logical_sb_block;
 	struct inode *root;
 	int ret = -ENOMEM;
-	unsigned int i;
 	int needs_recovery;
 	int err = 0;
 	ext4_group_t first_not_zeroed;
@@ -5627,10 +5634,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
 	utf8_unload(sb->s_encoding);
 #endif
 
-#ifdef CONFIG_QUOTA
-	for (i = 0; i < EXT4_MAXQUOTAS; i++)
-		kfree(get_qf_name(sb, sbi, i));
-#endif
+	ext4_free_quotas(sb, sbi);
 	fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
 	/* ext4_blkdev_remove() calls kill_bdev(), release bh before it. */
 	brelse(sbi->s_sbh);
-- 
2.39.2

-- 
Jens Axboe


             reply	other threads:[~2023-04-30 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-30 16:54 Jens Axboe [this message]
2023-04-30 18:01 ` [PATCH] ext4: silence complaint if CONFIG_QUOTA isn't set Theodore Ts'o

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=123c391a-2569-6afd-2461-4e5b2ca298f3@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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