public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext3: Cleanup ext3_setup_super()
@ 2010-10-10 12:36 Namhyung Kim
  2010-10-11 14:45 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2010-10-10 12:36 UTC (permalink / raw)
  To: Jan Kara, Andrew Morton, Andreas Dilger; +Cc: linux-ext4, linux-kernel

Fix mount-count check to emit warning only if s_max_mnt_count
is greater than 0 according to man tune2fs(8). Also removes
unnecessary casts.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---

If this looks fine, I'll send the same patches for ext2 and ext4.
Thanks.

 fs/ext3/super.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 5dbf4db..4caeffa 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1306,9 +1306,9 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
 		ext3_msg(sb, KERN_WARNING,
 			"warning: mounting fs with errors, "
 			"running e2fsck is recommended");
-	else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 &&
+	else if ((__s16) le16_to_cpu(es->s_max_mnt_count) > 0 &&
 		 le16_to_cpu(es->s_mnt_count) >=
-		 (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count))
+			le16_to_cpu(es->s_max_mnt_count))
 		ext3_msg(sb, KERN_WARNING,
 			"warning: maximal mount count reached, "
 			"running e2fsck is recommended");
@@ -1325,7 +1325,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
                    valid forever! :) */
 	es->s_state &= cpu_to_le16(~EXT3_VALID_FS);
 #endif
-	if (!(__s16) le16_to_cpu(es->s_max_mnt_count))
+	if (!le16_to_cpu(es->s_max_mnt_count))
 		es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT);
 	le16_add_cpu(&es->s_mnt_count, 1);
 	es->s_mtime = cpu_to_le32(get_seconds());
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext3: Cleanup ext3_setup_super()
  2010-10-10 12:36 [PATCH] ext3: Cleanup ext3_setup_super() Namhyung Kim
@ 2010-10-11 14:45 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2010-10-11 14:45 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Jan Kara, Andrew Morton, Andreas Dilger, linux-ext4, linux-kernel

On Sun 10-10-10 21:36:59, Namhyung Kim wrote:
> Fix mount-count check to emit warning only if s_max_mnt_count
> is greater than 0 according to man tune2fs(8). Also removes
> unnecessary casts.
  Good spotting. Merged.

								Honza

> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
> 
> If this looks fine, I'll send the same patches for ext2 and ext4.
> Thanks.
> 
>  fs/ext3/super.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext3/super.c b/fs/ext3/super.c
> index 5dbf4db..4caeffa 100644
> --- a/fs/ext3/super.c
> +++ b/fs/ext3/super.c
> @@ -1306,9 +1306,9 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
>  		ext3_msg(sb, KERN_WARNING,
>  			"warning: mounting fs with errors, "
>  			"running e2fsck is recommended");
> -	else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 &&
> +	else if ((__s16) le16_to_cpu(es->s_max_mnt_count) > 0 &&
>  		 le16_to_cpu(es->s_mnt_count) >=
> -		 (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count))
> +			le16_to_cpu(es->s_max_mnt_count))
>  		ext3_msg(sb, KERN_WARNING,
>  			"warning: maximal mount count reached, "
>  			"running e2fsck is recommended");
> @@ -1325,7 +1325,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
>                     valid forever! :) */
>  	es->s_state &= cpu_to_le16(~EXT3_VALID_FS);
>  #endif
> -	if (!(__s16) le16_to_cpu(es->s_max_mnt_count))
> +	if (!le16_to_cpu(es->s_max_mnt_count))
>  		es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT);
>  	le16_add_cpu(&es->s_mnt_count, 1);
>  	es->s_mtime = cpu_to_le32(get_seconds());
> -- 
> 1.7.0.4
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-11 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-10 12:36 [PATCH] ext3: Cleanup ext3_setup_super() Namhyung Kim
2010-10-11 14:45 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox