xfs
[Top] [All Lists]

Re: [PATCH 2/2] xfs: cleanup xfs_bmse_merge returns

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 2/2] xfs: cleanup xfs_bmse_merge returns
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Mon, 1 Dec 2014 11:41:36 -0500
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1417407608-8016-3-git-send-email-david@xxxxxxxxxxxxx>
References: <1417407608-8016-1-git-send-email-david@xxxxxxxxxxxxx> <1417407608-8016-3-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Mon, Dec 01, 2014 at 03:20:08PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  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@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH 2/2] xfs: cleanup xfs_bmse_merge returns, Brian Foster <=