Commit d9498fa8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Chandan Babu R

xfs: merge the calls to xfs_rtallocate_range in xfs_rtallocate_block

Use a goto to use a common tail for the case of being able to allocate
an extent.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent 9ade45b0
...@@ -252,19 +252,15 @@ xfs_rtallocate_extent_block( ...@@ -252,19 +252,15 @@ xfs_rtallocate_extent_block(
error = xfs_rtcheck_range(args, i, maxlen, 1, &next, &stat); error = xfs_rtcheck_range(args, i, maxlen, 1, &next, &stat);
if (error) if (error)
return error; return error;
if (stat) { if (stat) {
/* /*
* i for maxlen is all free, allocate and return that. * i for maxlen is all free, allocate and return that.
*/ */
error = xfs_rtallocate_range(args, i, maxlen); bestlen = maxlen;
if (error) besti = i;
return error; goto allocate;
*len = maxlen;
*rtx = i;
return 0;
} }
/* /*
* In the case where we have a variable-sized allocation * In the case where we have a variable-sized allocation
* request, figure out how big this free piece is, * request, figure out how big this free piece is,
...@@ -315,6 +311,7 @@ xfs_rtallocate_extent_block( ...@@ -315,6 +311,7 @@ xfs_rtallocate_extent_block(
/* /*
* Allocate besti for bestlen & return that. * Allocate besti for bestlen & return that.
*/ */
allocate:
error = xfs_rtallocate_range(args, besti, bestlen); error = xfs_rtallocate_range(args, besti, bestlen);
if (error) if (error)
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment