kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ritesh Harjani <riteshh@linux.ibm.com>
To: Markus Elfring <Markus.Elfring@web.de>,
	linux-ext4@vger.kernel.org,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Theodore Ts'o <tytso@mit.edu>
Cc: kernel-janitors@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ext4: Delete unnecessary checks before brelse()
Date: Wed, 08 Jul 2020 11:27:11 +0000	[thread overview]
Message-ID: <20200708111512.97DF5A405C@b06wcsmtp001.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <0d713702-072f-a89c-20ec-ca70aa83a432@web.de>



On 6/13/20 11:37 PM, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 13 Jun 2020 19:12:24 +0200
> 
> The brelse() function tests whether its argument is NULL
> and then returns immediately.
> Thus remove the tests which are not needed around the shown calls.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Sure, LGTM. Feel free to add
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>


> ---
>   fs/ext4/extents.c | 6 ++----
>   fs/ext4/xattr.c   | 3 +--
>   2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 221f240eae60..315276d50aa8 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -693,10 +693,8 @@ void ext4_ext_drop_refs(struct ext4_ext_path *path)
>   		return;
>   	depth = path->p_depth;
>   	for (i = 0; i <= depth; i++, path++) {
> -		if (path->p_bh) {
> -			brelse(path->p_bh);
> -			path->p_bh = NULL;
> -		}
> +		brelse(path->p_bh);
> +		path->p_bh = NULL;
>   	}
>   }
> 
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 9b29a40738ac..eb997ce21be3 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -1354,8 +1354,7 @@ static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode,
> 
>   	block = 0;
>   	while (wsize < bufsize) {
> -		if (bh != NULL)
> -			brelse(bh);
> +		brelse(bh);
>   		csize = (bufsize - wsize) > blocksize ? blocksize :
>   								bufsize - wsize;
>   		bh = ext4_getblk(handle, ea_inode, block, 0);
> --
> 2.27.0
> 

  reply	other threads:[~2020-07-08 11:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-13 18:07 [PATCH] ext4: Delete unnecessary checks before brelse() Markus Elfring
2020-07-08 11:27 ` Ritesh Harjani [this message]
2020-08-06  4:09 ` tytso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200708111512.97DF5A405C@b06wcsmtp001.portsmouth.uk.ibm.com \
    --to=riteshh@linux.ibm.com \
    --cc=Markus.Elfring@web.de \
    --cc=adilger.kernel@dilger.ca \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).