From: "Darrick J. Wong" <djwong@kernel.org>
To: Zeng Heng <zengheng4@huawei.com>
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next 2/2] xfs: simplify if-else condition in xfs_reflink_trim_around_shared
Date: Tue, 30 Aug 2022 08:12:47 -0700 [thread overview]
Message-ID: <Yw4o7yug91RORMD3@magnolia> (raw)
In-Reply-To: <20220830133939.2726749-3-zengheng4@huawei.com>
On Tue, Aug 30, 2022 at 09:39:39PM +0800, Zeng Heng wrote:
> "else" is not generally useful after a return,
> so remove it for clean code.
>
> There is no logical changes.
>
> Signed-off-by: Zeng Heng <zengheng4@huawei.com>
Looks correct to me,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_reflink.c | 22 ++++++++++++----------
> 1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 251f20ddd368..93bdd25680bc 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -200,7 +200,9 @@ xfs_reflink_trim_around_shared(
> if (fbno == NULLAGBLOCK) {
> /* No shared blocks at all. */
> return 0;
> - } else if (fbno == agbno) {
> + }
> +
> + if (fbno == agbno) {
> /*
> * The start of this extent is shared. Truncate the
> * mapping at the end of the shared region so that a
> @@ -210,16 +212,16 @@ xfs_reflink_trim_around_shared(
> irec->br_blockcount = flen;
> *shared = true;
> return 0;
> - } else {
> - /*
> - * There's a shared extent midway through this extent.
> - * Truncate the mapping at the start of the shared
> - * extent so that a subsequent iteration starts at the
> - * start of the shared region.
> - */
> - irec->br_blockcount = fbno - agbno;
> - return 0;
> }
> +
> + /*
> + * There's a shared extent midway through this extent.
> + * Truncate the mapping at the start of the shared
> + * extent so that a subsequent iteration starts at the
> + * start of the shared region.
> + */
> + irec->br_blockcount = fbno - agbno;
> + return 0;
> }
>
> int
> --
> 2.25.1
>
prev parent reply other threads:[~2022-08-30 15:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 13:39 [PATCH -next 0/2] Simplify if-else condition for clean code Zeng Heng
2022-08-30 13:39 ` [PATCH -next 1/2] xfs: simplify if-else condition in xfs_validate_new_dalign Zeng Heng
2022-08-30 15:19 ` Darrick J. Wong
2022-08-30 13:39 ` [PATCH -next 2/2] xfs: simplify if-else condition in xfs_reflink_trim_around_shared Zeng Heng
2022-08-30 15:12 ` Darrick J. Wong [this message]
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=Yw4o7yug91RORMD3@magnolia \
--to=djwong@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=zengheng4@huawei.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;
as well as URLs for NNTP newsgroup(s).