Re: [PATCH 14/22] xfs: merge the calls to xfs_rtallocate_range in xfs_rtallocate_block

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 18, 2023 at 05:57:30AM +0100, Christoph Hellwig wrote:
> Use a goto to use a common tail for the case of being able to allocate
> an extent.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Looks good now,
Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>

--D

> ---
>  fs/xfs/xfs_rtalloc.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
> index 6fcc847b116273..9604acd7aa6cec 100644
> --- a/fs/xfs/xfs_rtalloc.c
> +++ b/fs/xfs/xfs_rtalloc.c
> @@ -252,19 +252,15 @@ xfs_rtallocate_extent_block(
>  		error = xfs_rtcheck_range(args, i, maxlen, 1, &next, &stat);
>  		if (error)
>  			return error;
> -
>  		if (stat) {
>  			/*
>  			 * i for maxlen is all free, allocate and return that.
>  			 */
> -			error = xfs_rtallocate_range(args, i, maxlen);
> -			if (error)
> -				return error;
> -
> -			*len = maxlen;
> -			*rtx = i;
> -			return 0;
> +			bestlen = maxlen;
> +			besti = i;
> +			goto allocate;
>  		}
> +
>  		/*
>  		 * In the case where we have a variable-sized allocation
>  		 * request, figure out how big this free piece is,
> @@ -315,6 +311,7 @@ xfs_rtallocate_extent_block(
>  	/*
>  	 * Allocate besti for bestlen & return that.
>  	 */
> +allocate:
>  	error = xfs_rtallocate_range(args, besti, bestlen);
>  	if (error)
>  		return error;
> -- 
> 2.39.2
> 
> 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux