Skip to contentSkip to conversation

ext4: remove an unused variable warning with CONFIG_QUOTA=n

PATCH Applied Austin Kim 3 participants 4 messages Aug 24, 2021 – Oct 28, 2021 ext4 file system

lore
Share & tools
lore

Austin Kim

author
#0 lore raw

PATCH 1/1 ext4: remove an unused variable warning with CONFIG_QUOTA=n

The 'enable_quota' variable is only used in an CONFIG_QUOTA. With CONFIG_QUOTA=n, compiler causes a harmless warning:

fs/ext4/super.c: In function ‘ext4_remount’:
fs/ext4/super.c:5840:6: warning: variable ‘enable_quota’ set but not used
[-Wunused-but-set-variable]

  int enable_quota = 0;
              ^~~~~

Move 'enable_quota' into the same #ifdef CONFIG_QUOTA block to remove an unused variable warning.

---
 fs/ext4/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/super.c +3 -1
index 6b03e4281f6f..6adb570f4b31 100644
@@ -5845,10 +5845,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	unsigned long old_sb_flags, vfs_flags;
 	struct ext4_mount_options old_opts;
-	int enable_quota = 0;
 	ext4_group_t g;
 	int err = 0;
 #ifdef CONFIG_QUOTA
+	int enable_quota = 0;
 	int i, j;
 	char *to_free[EXT4_MAXQUOTAS];
 #endif
@@ -6053,7 +6053,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 					err = -EROFS;
 					goto restore_opts;
 				}
+#ifdef CONFIG_QUOTA
 			enable_quota = 1;
+#endif
 		}
 	}
 
Signature · 1 line
2.20.1
author
#1 lore raw

2021년 8월 24일 (화) 오후 12:49, Austin Kim <[email protected]>님이 작성:

Quoted 45 lines

The 'enable_quota' variable is only used in an CONFIG_QUOTA. With CONFIG_QUOTA=n, compiler causes a harmless warning:

fs/ext4/super.c: In function ‘ext4_remount’:
fs/ext4/super.c:5840:6: warning: variable ‘enable_quota’ set but not used
[-Wunused-but-set-variable]

  int enable_quota = 0;
              ^~~~~

Move 'enable_quota' into the same #ifdef CONFIG_QUOTA block to remove an unused variable warning.

---
 fs/ext4/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/super.c +3 -2
index 6b03e4281f6f..6adb570f4b31 100644
@@ -5845,10 +5845,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
        struct ext4_sb_info *sbi = EXT4_SB(sb);
        unsigned long old_sb_flags, vfs_flags;
        struct ext4_mount_options old_opts;
-       int enable_quota = 0;
        ext4_group_t g;
        int err = 0;
 #ifdef CONFIG_QUOTA
+       int enable_quota = 0;
        int i, j;
        char *to_free[EXT4_MAXQUOTAS];
 #endif
@@ -6053,7 +6053,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
                                        err = -EROFS;
                                        goto restore_opts;
                                }
+#ifdef CONFIG_QUOTA
                        enable_quota = 1;
+#endif
                }
        }
 
--
Quoted 2 lines

2.20.1

If you are available, would you please review this patch? It will not take long.

BR,
Austin Kim

reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Austin Kim
Quoted 6 lines · Austin Kim

The 'enable_quota' variable is only used in an CONFIG_QUOTA. With CONFIG_QUOTA=n, compiler causes a harmless warning:

fs/ext4/super.c: In function ‘ext4_remount’:
fs/ext4/super.c:5840:6: warning: variable ‘enable_quota’ set but not used
[-Wunused-but-set-variable]

Quoted 7 lines
  int enable_quota = 0;
              ^~~~~

Move 'enable_quota' into the same #ifdef CONFIG_QUOTA block to remove an unused variable warning.

I guess this has fallen through the cracks. The fix looks good to me. Feel free to add:

Honza

Quoted 33 lines
---
 fs/ext4/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/super.c +3 -1
index 6b03e4281f6f..6adb570f4b31 100644
@@ -5845,10 +5845,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	unsigned long old_sb_flags, vfs_flags;
 	struct ext4_mount_options old_opts;
-	int enable_quota = 0;
 	ext4_group_t g;
 	int err = 0;
 #ifdef CONFIG_QUOTA
+	int enable_quota = 0;
 	int i, j;
 	char *to_free[EXT4_MAXQUOTAS];
 #endif
@@ -6053,7 +6053,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 					err = -EROFS;
 					goto restore_opts;
 				}
+#ifdef CONFIG_QUOTA
 			enable_quota = 1;
+#endif
 		}
 	}
 
Signature · 1 line
2.20.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#3 lore raw
In reply to Austin Kim
Quoted 10 lines · Austin Kim

The 'enable_quota' variable is only used in an CONFIG_QUOTA. With CONFIG_QUOTA=n, compiler causes a harmless warning:

fs/ext4/super.c: In function ‘ext4_remount’:
fs/ext4/super.c:5840:6: warning: variable ‘enable_quota’ set but not used
[-Wunused-but-set-variable]

  int enable_quota = 0;
              ^~~~~

[...]

Applied, thanks!

[1/1] ext4: remove an unused variable warning with CONFIG_QUOTA=n

      commit: d94ca0e1d65f4c274e3425a35f23ffe58ecea18a

Best regards,

Signature · 1 line
Theodore Ts'o <[email protected]>