ext4: silence complaint if CONFIG_QUOTA isn't set
Commit Message
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(-)
Comments
On Sun, Apr 30, 2023 at 10:54:38AM -0600, Jens Axboe wrote:
> Compiling the kernel ext4 spews a warning that 'i' is unused in two
> spots:
Thanks, we have a fix for this queued up for Linus already. It should
be pushed out shortly...
Cheers,
- Ted
@@ -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);