aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_rtalloc.c
diff options
context:
space:
mode:
authorChristoph Hellwig <[email protected]>2023-12-18 04:57:30 +0000
committerChandan Babu R <[email protected]>2023-12-22 05:48:13 +0000
commitd9498fa8c8580b9cedb764e475503706ba7a0fbf (patch)
tree26ed9d0f10da0cb211cd87c50d8f86193760fff0 /fs/xfs/xfs_rtalloc.c
parentxfs: reflow the tail end of xfs_rtallocate_extent_block (diff)
downloadkernel-d9498fa8c8580b9cedb764e475503706ba7a0fbf.tar.gz
kernel-d9498fa8c8580b9cedb764e475503706ba7a0fbf.zip
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 <[email protected]> Reviewed-by: "Darrick J. Wong" <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
Diffstat (limited to 'fs/xfs/xfs_rtalloc.c')
-rw-r--r--fs/xfs/xfs_rtalloc.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index c52f479e3abd..774e55cd602f 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;