linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext2: cleanup the confused goto label
@ 2012-06-24  2:51 Wanlong Gao
  2012-06-27 16:29 ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Wanlong Gao @ 2012-06-24  2:51 UTC (permalink / raw)
  To: jack; +Cc: linux-ext4, Wanlong Gao

Cleanup the confused goto label in ext2_fill_super.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
---
 fs/ext2/super.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index b3621cb..301379d 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -771,14 +771,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 	err = -ENOMEM;
 	sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
 	if (!sbi)
-		goto failed_unlock;
+		goto failed;
 
 	sbi->s_blockgroup_lock =
 		kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
-	if (!sbi->s_blockgroup_lock) {
-		kfree(sbi);
-		goto failed_unlock;
-	}
+	if (!sbi->s_blockgroup_lock)
+		goto failed_sbi;
+
 	sb->s_fs_info = sbi;
 	sbi->s_sb_block = sb_block;
 
@@ -794,7 +793,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 	blocksize = sb_min_blocksize(sb, BLOCK_SIZE);
 	if (!blocksize) {
 		ext2_msg(sb, KERN_ERR, "error: unable to set blocksize");
-		goto failed_sbi;
+		goto failed_bg_lock;
 	}
 
 	/*
@@ -810,7 +809,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 
 	if (!(bh = sb_bread(sb, logic_sb_block))) {
 		ext2_msg(sb, KERN_ERR, "error: unable to read superblock");
-		goto failed_sbi;
+		goto failed_bg_lock;
 	}
 	/*
 	 * Note: s_es must be initialized as soon as possible because
@@ -905,7 +904,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 		if (!sb_set_blocksize(sb, blocksize)) {
 			ext2_msg(sb, KERN_ERR,
 				"error: bad blocksize %d", blocksize);
-			goto failed_sbi;
+			goto failed_bg_lock;
 		}
 
 		logic_sb_block = (sb_block*BLOCK_SIZE) / blocksize;
@@ -914,7 +913,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 		if(!bh) {
 			ext2_msg(sb, KERN_ERR, "error: couldn't read"
 				"superblock on 2nd try");
-			goto failed_sbi;
+			goto failed_bg_lock;
 		}
 		es = (struct ext2_super_block *) (((char *)bh->b_data) + offset);
 		sbi->s_es = es;
@@ -1126,11 +1125,12 @@ failed_mount_group_desc:
 	kfree(sbi->s_debts);
 failed_mount:
 	brelse(bh);
-failed_sbi:
+failed_bg_lock:
 	sb->s_fs_info = NULL;
 	kfree(sbi->s_blockgroup_lock);
+failed_sbi:
 	kfree(sbi);
-failed_unlock:
+failed:
 	return ret;
 }
 
-- 
1.7.11.rc0


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

* Re: [PATCH] ext2: cleanup the confused goto label
  2012-06-24  2:51 [PATCH] ext2: cleanup the confused goto label Wanlong Gao
@ 2012-06-27 16:29 ` Jan Kara
  2012-06-27 16:49   ` Wanlong Gao
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kara @ 2012-06-27 16:29 UTC (permalink / raw)
  To: Wanlong Gao; +Cc: jack, linux-ext4

On Sun 24-06-12 10:51:43, Wanlong Gao wrote:
> Cleanup the confused goto label in ext2_fill_super.
> 
> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
>  fs/ext2/super.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index b3621cb..301379d 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -771,14 +771,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  	err = -ENOMEM;
>  	sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
>  	if (!sbi)
> -		goto failed_unlock;
> +		goto failed;
  This change is OK...

>  
>  	sbi->s_blockgroup_lock =
>  		kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
> -	if (!sbi->s_blockgroup_lock) {
> -		kfree(sbi);
> -		goto failed_unlock;
> -	}
> +	if (!sbi->s_blockgroup_lock)
> +		goto failed_sbi;
> +
  ... but this and all the changes below really look like an unnecessary
code churn. So please just submit that one change. Thanks.

										Honza

>  	sb->s_fs_info = sbi;
>  	sbi->s_sb_block = sb_block;
>  
> @@ -794,7 +793,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  	blocksize = sb_min_blocksize(sb, BLOCK_SIZE);
>  	if (!blocksize) {
>  		ext2_msg(sb, KERN_ERR, "error: unable to set blocksize");
> -		goto failed_sbi;
> +		goto failed_bg_lock;
>  	}
>  
>  	/*
> @@ -810,7 +809,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  
>  	if (!(bh = sb_bread(sb, logic_sb_block))) {
>  		ext2_msg(sb, KERN_ERR, "error: unable to read superblock");
> -		goto failed_sbi;
> +		goto failed_bg_lock;
>  	}
>  	/*
>  	 * Note: s_es must be initialized as soon as possible because
> @@ -905,7 +904,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  		if (!sb_set_blocksize(sb, blocksize)) {
>  			ext2_msg(sb, KERN_ERR,
>  				"error: bad blocksize %d", blocksize);
> -			goto failed_sbi;
> +			goto failed_bg_lock;
>  		}
>  
>  		logic_sb_block = (sb_block*BLOCK_SIZE) / blocksize;
> @@ -914,7 +913,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  		if(!bh) {
>  			ext2_msg(sb, KERN_ERR, "error: couldn't read"
>  				"superblock on 2nd try");
> -			goto failed_sbi;
> +			goto failed_bg_lock;
>  		}
>  		es = (struct ext2_super_block *) (((char *)bh->b_data) + offset);
>  		sbi->s_es = es;
> @@ -1126,11 +1125,12 @@ failed_mount_group_desc:
>  	kfree(sbi->s_debts);
>  failed_mount:
>  	brelse(bh);
> -failed_sbi:
> +failed_bg_lock:
>  	sb->s_fs_info = NULL;
>  	kfree(sbi->s_blockgroup_lock);
> +failed_sbi:
>  	kfree(sbi);
> -failed_unlock:
> +failed:
>  	return ret;
>  }
>  
> -- 
> 1.7.11.rc0
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

* [PATCH] ext2: cleanup the confused goto label
  2012-06-27 16:29 ` Jan Kara
@ 2012-06-27 16:49   ` Wanlong Gao
  2012-06-27 17:19     ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Wanlong Gao @ 2012-06-27 16:49 UTC (permalink / raw)
  To: jack; +Cc: linux-ext4, Wanlong Gao

Cleanup the confused goto label, since the big lock has been removed.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
---
 fs/ext2/super.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index b3621cb..c8e4979 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -771,13 +771,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 	err = -ENOMEM;
 	sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
 	if (!sbi)
-		goto failed_unlock;
+		goto failed;
 
 	sbi->s_blockgroup_lock =
 		kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
 	if (!sbi->s_blockgroup_lock) {
 		kfree(sbi);
-		goto failed_unlock;
+		goto failed;
 	}
 	sb->s_fs_info = sbi;
 	sbi->s_sb_block = sb_block;
@@ -1130,7 +1130,7 @@ failed_sbi:
 	sb->s_fs_info = NULL;
 	kfree(sbi->s_blockgroup_lock);
 	kfree(sbi);
-failed_unlock:
+failed:
 	return ret;
 }
 
-- 
1.7.11.rc0


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

* Re: [PATCH] ext2: cleanup the confused goto label
  2012-06-27 16:49   ` Wanlong Gao
@ 2012-06-27 17:19     ` Jan Kara
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2012-06-27 17:19 UTC (permalink / raw)
  To: Wanlong Gao; +Cc: jack, linux-ext4

On Thu 28-06-12 00:49:44, Wanlong Gao wrote:
> Cleanup the confused goto label, since the big lock has been removed.
  Thanks! Merged.

									Honza
> 
> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
>  fs/ext2/super.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index b3621cb..c8e4979 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -771,13 +771,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  	err = -ENOMEM;
>  	sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
>  	if (!sbi)
> -		goto failed_unlock;
> +		goto failed;
>  
>  	sbi->s_blockgroup_lock =
>  		kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
>  	if (!sbi->s_blockgroup_lock) {
>  		kfree(sbi);
> -		goto failed_unlock;
> +		goto failed;
>  	}
>  	sb->s_fs_info = sbi;
>  	sbi->s_sb_block = sb_block;
> @@ -1130,7 +1130,7 @@ failed_sbi:
>  	sb->s_fs_info = NULL;
>  	kfree(sbi->s_blockgroup_lock);
>  	kfree(sbi);
> -failed_unlock:
> +failed:
>  	return ret;
>  }
>  
> -- 
> 1.7.11.rc0
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

end of thread, other threads:[~2012-06-27 17:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-24  2:51 [PATCH] ext2: cleanup the confused goto label Wanlong Gao
2012-06-27 16:29 ` Jan Kara
2012-06-27 16:49   ` Wanlong Gao
2012-06-27 17:19     ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).