Skip to content

Commit d9498fa

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
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: Christoph Hellwig <hch@lst.de> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
1 parent 9ade45b commit d9498fa

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

fs/xfs/xfs_rtalloc.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,19 +252,15 @@ xfs_rtallocate_extent_block(
252252
error = xfs_rtcheck_range(args, i, maxlen, 1, &next, &stat);
253253
if (error)
254254
return error;
255-
256255
if (stat) {
257256
/*
258257
* i for maxlen is all free, allocate and return that.
259258
*/
260-
error = xfs_rtallocate_range(args, i, maxlen);
261-
if (error)
262-
return error;
263-
264-
*len = maxlen;
265-
*rtx = i;
266-
return 0;
259+
bestlen = maxlen;
260+
besti = i;
261+
goto allocate;
267262
}
263+
268264
/*
269265
* In the case where we have a variable-sized allocation
270266
* request, figure out how big this free piece is,
@@ -315,6 +311,7 @@ xfs_rtallocate_extent_block(
315311
/*
316312
* Allocate besti for bestlen & return that.
317313
*/
314+
allocate:
318315
error = xfs_rtallocate_range(args, besti, bestlen);
319316
if (error)
320317
return error;

0 commit comments

Comments
 (0)