public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/2] xfs: cleanup xfs_bmse_merge returns
Date: Mon, 1 Dec 2014 11:41:36 -0500	[thread overview]
Message-ID: <20141201164136.GC23055@bfoster.bfoster> (raw)
In-Reply-To: <1417407608-8016-3-git-send-email-david@fromorbit.com>

On Mon, Dec 01, 2014 at 03:20:08PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> 
> xfs_bmse_merge() has a jump label for return that just returns the
> error value. Convert all the code to just return the error directly
> and use XFS_WANT_CORRUPTED_RETURN. This also allows the final call
> to xfs_bmbt_update() to return directly.
> 
> Noticed while reviewing coccinelle return cleanup patches and
> wondering why the same return pattern as in xfs_bmse_shift_one()
> wasn't picked up by the checker pattern...
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/libxfs/xfs_bmap.c | 23 ++++++++---------------
>  1 file changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 0628a67..5a42e2b 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -5489,32 +5489,25 @@ xfs_bmse_merge(
>  	error = xfs_bmbt_lookup_eq(cur, got.br_startoff, got.br_startblock,
>  				   got.br_blockcount, &i);
>  	if (error)
> -		goto out_error;
> -	XFS_WANT_CORRUPTED_GOTO(i == 1, out_error);
> +		return error;
> +	XFS_WANT_CORRUPTED_RETURN(i == 1);
>  
>  	error = xfs_btree_delete(cur, &i);
>  	if (error)
> -		goto out_error;
> -	XFS_WANT_CORRUPTED_GOTO(i == 1, out_error);
> +		return error;
> +	XFS_WANT_CORRUPTED_RETURN(i == 1);
>  
>  	/* lookup and update size of the previous extent */
>  	error = xfs_bmbt_lookup_eq(cur, left.br_startoff, left.br_startblock,
>  				   left.br_blockcount, &i);
>  	if (error)
> -		goto out_error;
> -	XFS_WANT_CORRUPTED_GOTO(i == 1, out_error);
> +		return error;
> +	XFS_WANT_CORRUPTED_RETURN(i == 1);
>  
>  	left.br_blockcount = blockcount;
>  
> -	error = xfs_bmbt_update(cur, left.br_startoff, left.br_startblock,
> -				left.br_blockcount, left.br_state);
> -	if (error)
> -		goto out_error;
> -
> -	return 0;
> -
> -out_error:
> -	return error;
> +	return xfs_bmbt_update(cur, left.br_startoff, left.br_startblock,
> +			       left.br_blockcount, left.br_state);
>  }
>  
>  /*
> -- 
> 2.0.0
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2014-12-01 16:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01  4:20 [PATCH 0/2] xfs: more return cleanups Dave Chinner
2014-12-01  4:20 ` [PATCH 1/2] xfs: cleanup xfs_bmse_shift_one goto mess Dave Chinner
2014-12-01 16:41   ` Brian Foster
2014-12-01  4:20 ` [PATCH 2/2] xfs: cleanup xfs_bmse_merge returns Dave Chinner
2014-12-01 16:41   ` Brian Foster [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=20141201164136.GC23055@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=xfs@oss.sgi.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