lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yw4o7yug91RORMD3@magnolia>
Date:   Tue, 30 Aug 2022 08:12:47 -0700
From:   "Darrick J. Wong" <djwong@...nel.org>
To:     Zeng Heng <zengheng4@...wei.com>
Cc:     linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next 2/2] xfs: simplify if-else condition in
 xfs_reflink_trim_around_shared

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@...wei.com>

Looks correct to me,
Reviewed-by: Darrick J. Wong <djwong@...nel.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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ