From: Filipe Manana <fdmanana@kernel.org>
To: Naohiro Aota <naohiro.aota@wdc.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 4/4] btrfs: replace unnecessary goto with direct return
Date: Fri, 17 Jun 2022 11:13:18 +0100 [thread overview]
Message-ID: <20220617101318.GB4041436@falcondesktop> (raw)
In-Reply-To: <7ccae9fc6975246cbb2be58c83d9ca6e3fcbb123.1655391633.git.naohiro.aota@wdc.com>
On Fri, Jun 17, 2022 at 12:45:42AM +0900, Naohiro Aota wrote:
> The "goto out;"s in cow_file_range() just results in a simple "return
> ret;" which are not really useful. Replace them with proper direct
> "return"s. It also makes the success path vs failure path stands out.
>
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
The subject is too generic, just adding "... at cow_file_range()" would make
it much more clear without being too long.
Thanks.
> ---
> fs/btrfs/inode.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index cae15924fc99..055c573e2eb3 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -1253,7 +1253,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
> * inline extent or a compressed extent.
> */
> unlock_page(locked_page);
> - goto out;
> + return 0;
> } else if (ret < 0) {
> goto out_unlock;
> }
> @@ -1366,8 +1366,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
> if (ret)
> goto out_unlock;
> }
> -out:
> - return ret;
> + return 0;
>
> out_drop_extent_cache:
> btrfs_drop_extent_cache(inode, start, start + ram_size - 1, 0);
> @@ -1425,7 +1424,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
> page_ops);
> start += cur_alloc_size;
> if (start >= end)
> - goto out;
> + return ret;
> }
>
> /*
> @@ -1437,7 +1436,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
> extent_clear_unlock_delalloc(inode, start, end, locked_page,
> clear_bits | EXTENT_CLEAR_DATA_RESV,
> page_ops);
> - goto out;
> + return ret;
> }
>
> /*
> --
> 2.35.1
>
next prev parent reply other threads:[~2022-06-17 10:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 15:45 [PATCH 0/4] btrfs: fix error handling of cow_file_range(unlock = 0) Naohiro Aota
2022-06-16 15:45 ` [PATCH 1/4] btrfs: ensure pages are unlocked on cow_file_range() failure Naohiro Aota
2022-06-17 10:11 ` Filipe Manana
2022-06-20 2:22 ` Naohiro Aota
2022-06-16 15:45 ` [PATCH 2/4] btrfs: extend btrfs_cleanup_ordered_extens for NULL locked_page Naohiro Aota
2022-06-17 10:15 ` Filipe Manana
2022-06-20 2:28 ` Naohiro Aota
2022-06-16 15:45 ` [PATCH 3/4] btrfs: fix error handling of fallbacked uncompress write Naohiro Aota
2022-06-17 10:21 ` Filipe Manana
2022-06-20 2:26 ` Naohiro Aota
2022-06-16 15:45 ` [PATCH 4/4] btrfs: replace unnecessary goto with direct return Naohiro Aota
2022-06-17 10:13 ` Filipe Manana [this message]
2022-06-20 2:22 ` Naohiro Aota
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=20220617101318.GB4041436@falcondesktop \
--to=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=naohiro.aota@wdc.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