diff mbox

[5/8] xfs: minor cleanup for xfs_get_blocks

Message ID 20180313143601.30028-6-hch@lst.de (mailing list archive)
State Accepted
Headers show

Commit Message

Christoph Hellwig March 13, 2018, 2:35 p.m. UTC
Simplify the control flow a bit in preparation for O_ATOMIC-related
changes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_aops.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Darrick J. Wong March 13, 2018, 8:45 p.m. UTC | #1
On Tue, Mar 13, 2018 at 03:35:58PM +0100, Christoph Hellwig wrote:
> Simplify the control flow a bit in preparation for O_ATOMIC-related
> changes.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_aops.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
> index c79a3ca20ef8..19eadc807056 100644
> --- a/fs/xfs/xfs_aops.c
> +++ b/fs/xfs/xfs_aops.c
> @@ -1335,17 +1335,16 @@ xfs_get_blocks(
>  			&nimaps, 0);
>  	if (error)
>  		goto out_unlock;
> -
> -	if (nimaps) {
> -		trace_xfs_get_blocks_found(ip, offset, size,
> -			imap.br_state == XFS_EXT_UNWRITTEN ?
> -				XFS_IO_UNWRITTEN : XFS_IO_OVERWRITE, &imap);
> -		xfs_iunlock(ip, lockmode);
> -	} else {
> +	if (!nimaps) {
>  		trace_xfs_get_blocks_notfound(ip, offset, size);
>  		goto out_unlock;
>  	}
>  
> +	trace_xfs_get_blocks_found(ip, offset, size,
> +		imap.br_state == XFS_EXT_UNWRITTEN ?
> +			XFS_IO_UNWRITTEN : XFS_IO_OVERWRITE, &imap);
> +	xfs_iunlock(ip, lockmode);
> +
>  	/* trim mapping down to size requested */
>  	xfs_map_trim_size(inode, iblock, bh_result, &imap, offset, size);
>  
> -- 
> 2.14.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index c79a3ca20ef8..19eadc807056 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1335,17 +1335,16 @@  xfs_get_blocks(
 			&nimaps, 0);
 	if (error)
 		goto out_unlock;
-
-	if (nimaps) {
-		trace_xfs_get_blocks_found(ip, offset, size,
-			imap.br_state == XFS_EXT_UNWRITTEN ?
-				XFS_IO_UNWRITTEN : XFS_IO_OVERWRITE, &imap);
-		xfs_iunlock(ip, lockmode);
-	} else {
+	if (!nimaps) {
 		trace_xfs_get_blocks_notfound(ip, offset, size);
 		goto out_unlock;
 	}
 
+	trace_xfs_get_blocks_found(ip, offset, size,
+		imap.br_state == XFS_EXT_UNWRITTEN ?
+			XFS_IO_UNWRITTEN : XFS_IO_OVERWRITE, &imap);
+	xfs_iunlock(ip, lockmode);
+
 	/* trim mapping down to size requested */
 	xfs_map_trim_size(inode, iblock, bh_result, &imap, offset, size);