public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
	Marek Behun <marek.behun@nic.cz>
Cc: Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org, u-boot@lists.denx.de
Subject: Re: [PATCH 1/1] btrfs: simplify lookup_data_extent()
Date: Wed, 11 May 2022 08:10:09 +0530	[thread overview]
Message-ID: <efbf9592-364b-d704-0ad0-5a1664da4e18@oracle.com> (raw)
In-Reply-To: <20220510194338.24881-1-heinrich.schuchardt@canonical.com>

On 5/11/22 01:13, Heinrich Schuchardt wrote:
> After returning if ret <= 0 we know that ret > 0. No need to check it.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Reviewed-by: Anand Jain <anand.jain>


> ---
>   fs/btrfs/inode.c | 15 ++++++---------
>   1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index d00b515333..0173d30cd8 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -546,15 +546,12 @@ static int lookup_data_extent(struct btrfs_root *root, struct btrfs_path *path,
>   	/* Error or we're already at the file extent */
>   	if (ret <= 0)
>   		return ret;
> -	if (ret > 0) {
> -		/* Check previous file extent */
> -		ret = btrfs_previous_item(root, path, ino,
> -					  BTRFS_EXTENT_DATA_KEY);
> -		if (ret < 0)
> -			return ret;
> -		if (ret > 0)
> -			goto check_next;
> -	}
> +	/* Check previous file extent */
> +	ret = btrfs_previous_item(root, path, ino, BTRFS_EXTENT_DATA_KEY);
> +	if (ret < 0)
> +		return ret;
> +	if (ret > 0)
> +		goto check_next;
>   	/* Now the key.offset must be smaller than @file_offset */
>   	btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
>   	if (key.objectid != ino ||


  parent reply	other threads:[~2022-05-11  2:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 19:43 [PATCH 1/1] btrfs: simplify lookup_data_extent() Heinrich Schuchardt
2022-05-10 22:48 ` Qu Wenruo
2022-05-11  7:06   ` Qu Wenruo
2022-05-11  2:40 ` Anand Jain [this message]
2022-06-07 16:46 ` Tom Rini

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=efbf9592-364b-d704-0ad0-5a1664da4e18@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=u-boot@lists.denx.de \
    --cc=wqu@suse.com \
    /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