Patchwork [4/4] ext4: remove unnecessary NULL pointer check

login
register
mail settings
Submitter Guo Chao
Date Jan. 18, 2013, 8:01 a.m.
Message ID <1358496074-6228-4-git-send-email-yan@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/213518/
State Accepted
Headers show

Comments

Guo Chao - Jan. 18, 2013, 8:01 a.m.
brelse() and ext4_journal_force_commit() are both inlined and able
to handle NULL.

Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
---
 fs/ext4/namei.c |    3 +--
 fs/ext4/super.c |    6 +-----
 2 files changed, 2 insertions(+), 7 deletions(-)
Darrick J. Wong - Jan. 29, 2013, 1:24 a.m.
On Fri, Jan 18, 2013 at 04:01:14PM +0800, Guo Chao wrote:
> brelse() and ext4_journal_force_commit() are both inlined and able
> to handle NULL.
> 
> Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>

This one looks ok too, so:
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

PS: Does the order of the patches matter?  Or are these just four patches that
are mostly independent of each other?

--D
> ---
>  fs/ext4/namei.c |    3 +--
>  fs/ext4/super.c |    6 +-----
>  2 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index e35ea3d..f0812c0 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2110,8 +2110,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
>  journal_error:
>  	ext4_std_error(dir->i_sb, err);
>  cleanup:
> -	if (bh)
> -		brelse(bh);
> +	brelse(bh);
>  	dx_release(frames);
>  	return err;
>  }
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 3d4fb81..f3acd6f 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4476,16 +4476,12 @@ static void ext4_clear_journal_err(struct super_block *sb,
>  int ext4_force_commit(struct super_block *sb)
>  {
>  	journal_t *journal;
> -	int ret = 0;
>  
>  	if (sb->s_flags & MS_RDONLY)
>  		return 0;
>  
>  	journal = EXT4_SB(sb)->s_journal;
> -	if (journal)
> -		ret = ext4_journal_force_commit(journal);
> -
> -	return ret;
> +	return ext4_journal_force_commit(journal);
>  }
>  
>  static int ext4_sync_fs(struct super_block *sb, int wait)
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guo Chao - Jan. 29, 2013, 2:40 a.m.
On Mon, Jan 28, 2013 at 05:24:13PM -0800, Darrick J. Wong wrote:
> On Fri, Jan 18, 2013 at 04:01:14PM +0800, Guo Chao wrote:
> > brelse() and ext4_journal_force_commit() are both inlined and able
> > to handle NULL.
> > 
> > Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
> 
> This one looks ok too, so:
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> PS: Does the order of the patches matter?  Or are these just four patches that
> are mostly independent of each other?
> 
> --D

They are random independent fixes.

Thanks


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - Jan. 29, 2013, 2:42 a.m.
On Mon, Jan 28, 2013 at 05:24:13PM -0800, Darrick J. Wong wrote:
> On Fri, Jan 18, 2013 at 04:01:14PM +0800, Guo Chao wrote:
> > brelse() and ext4_journal_force_commit() are both inlined and able
> > to handle NULL.
> > 
> > Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
> 
> This one looks ok too, so:
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

Thanks, applied.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index e35ea3d..f0812c0 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2110,8 +2110,7 @@  static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
 journal_error:
 	ext4_std_error(dir->i_sb, err);
 cleanup:
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	dx_release(frames);
 	return err;
 }
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3d4fb81..f3acd6f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4476,16 +4476,12 @@  static void ext4_clear_journal_err(struct super_block *sb,
 int ext4_force_commit(struct super_block *sb)
 {
 	journal_t *journal;
-	int ret = 0;
 
 	if (sb->s_flags & MS_RDONLY)
 		return 0;
 
 	journal = EXT4_SB(sb)->s_journal;
-	if (journal)
-		ret = ext4_journal_force_commit(journal);
-
-	return ret;
+	return ext4_journal_force_commit(journal);
 }
 
 static int ext4_sync_fs(struct super_block *sb, int wait)