2005-09-29 01:47:17

by pinotj

[permalink] [raw]
Subject: [PATCH][2.6.14-rc2] ext3: fix build warning if !quota

Hi,

(My first e-mail seems to be lost somewhere, here is a second try)

sbi is not used if quota is not defined. This leads to a useless
variable after preprocessing and a build warning.

This moves the declaration in right place.

------8<------
diff -Naur a/fs/ext3/super.c b/fs/ext3/super.c
--- a/fs/ext3/super.c 2005-09-29 00:28:16.000000000 +0000
+++ b/fs/ext3/super.c 2005-09-29 00:25:02.000000000 +0000
@@ -513,7 +513,6 @@
static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs)
{
struct super_block *sb = vfs->mnt_sb;
- struct ext3_sb_info *sbi = EXT3_SB(sb);

if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
seq_puts(seq, ",data=journal");
@@ -523,6 +522,8 @@
seq_puts(seq, ",data=writeback");

#if defined(CONFIG_QUOTA)
+ struct ext3_sb_info *sbi = EXT3_SB(sb);
+
if (sbi->s_jquota_fmt)
seq_printf(seq, ",jqfmt=%s",
(sbi->s_jquota_fmt == QFMT_VFS_OLD) ? "vfsold": "vfsv0");
------8<------

Signed-off-by: Jerome Pinot <[email protected]>


Regards,

--
Jerome Pinot
http://ngc891.blogdns.net/


2005-09-29 01:57:21

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH][2.6.14-rc2] ext3: fix build warning if !quota

On Thu, Sep 29, 2005 at 03:46:53AM +0200, [email protected] wrote:
> Hi,
>
> (My first e-mail seems to be lost somewhere, here is a second try)
>
> sbi is not used if quota is not defined. This leads to a useless
> variable after preprocessing and a build warning.
>
> This moves the declaration in right place.

... and puts declaration in the middle of code.

2005-09-29 02:24:08

by pinotj

[permalink] [raw]
Subject: Re: [PATCH][2.6.14-rc2] ext3: fix build warning if !quota


>Date: Thu, 29 Sep 2005 02:57:20 +0100
>From: Al Viro
>To: pinotj
>Cc: linux-kernel
>Subject: Re: [PATCH][2.6.14-rc2] ext3: fix build warning if !quota
[...]
>.... and puts declaration in the middle of code.
>

Is this better ?

------8<------
diff -Naur a/fs/ext3/super.c b/fs/ext3/super.c
--- a/fs/ext3/super.c 2005-09-29 00:28:16.000000000 +0000
+++ b/fs/ext3/super.c 2005-09-29 02:18:22.000000000 +0000
@@ -513,7 +513,9 @@
static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs)
{
struct super_block *sb = vfs->mnt_sb;
+#if defined(CONFIG_QUOTA)
struct ext3_sb_info *sbi = EXT3_SB(sb);
+#endif

if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
seq_puts(seq, ",data=journal");
------8<------


--
Jerome Pinot
http://ngc891.blogdns.net/

2005-09-29 10:10:39

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH][2.6.14-rc2] ext3: fix build warning if !quota

>
> >Date: Thu, 29 Sep 2005 02:57:20 +0100
> >From: Al Viro
> >To: pinotj
> >Cc: linux-kernel
> >Subject: Re: [PATCH][2.6.14-rc2] ext3: fix build warning if !quota
> [...]
> >.... and puts declaration in the middle of code.
> >
>
> Is this better ?
Yes, I like this version better. I guess you can submit it to Andrew.
(and add your Signed-off-by before the patch (Andrew's scripts won't find
it otherwise I guess. Feel free to add mine too).

Honza

> ------8<------
> diff -Naur a/fs/ext3/super.c b/fs/ext3/super.c
> --- a/fs/ext3/super.c 2005-09-29 00:28:16.000000000 +0000
> +++ b/fs/ext3/super.c 2005-09-29 02:18:22.000000000 +0000
> @@ -513,7 +513,9 @@
> static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs)
> {
> struct super_block *sb = vfs->mnt_sb;
> +#if defined(CONFIG_QUOTA)
> struct ext3_sb_info *sbi = EXT3_SB(sb);
> +#endif
>
> if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
> seq_puts(seq, ",data=journal");
> ------8<------
>
>
> --
> Jerome Pinot
> http://ngc891.blogdns.net/
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2005-09-29 16:45:59

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH][2.6.14-rc2] ext3: fix build warning if !quota

Jerome Pinot <[email protected]> writes:

> sbi is not used if quota is not defined. This leads to a useless
> variable after preprocessing and a build warning.
>
> This moves the declaration in right place.

Sorry, my fault. But we use -Wdeclaration-after-statement option.
So, gcc-4.0.1 warns it, and gcc info says "not supported before GCC 3.0".

fs/ext3/super.c: In function 'ext3_show_options':
fs/ext3/super.c:525: warning: ISO C90 forbids mixed declarations and code

How about this instead?

Thanks.
--
OGAWA Hirofumi <[email protected]>

Signed-off-by: OGAWA Hirofumi <[email protected]>
---

fs/ext3/super.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN fs/ext3/super.c~aaa fs/ext3/super.c
--- linux-2.6.14-rc2-a/fs/ext3/super.c~aaa 2005-09-30 01:10:55.000000000 +0900
+++ linux-2.6.14-rc2-a-hirofumi/fs/ext3/super.c 2005-09-30 01:10:55.000000000 +0900
@@ -513,8 +513,9 @@ static void ext3_clear_inode(struct inod
static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs)
{
struct super_block *sb = vfs->mnt_sb;
+#if defined(CONFIG_QUOTA)
struct ext3_sb_info *sbi = EXT3_SB(sb);
-
+#endif
if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
seq_puts(seq, ",data=journal");
else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA)
_