]> git.itanic.dy.fi Git - linux-stable/commitdiff
xfs: merge the calls to xfs_rtallocate_range in xfs_rtallocate_block
authorChristoph Hellwig <hch@lst.de>
Mon, 18 Dec 2023 04:57:30 +0000 (05:57 +0100)
committerChandan Babu R <chandanbabu@kernel.org>
Fri, 22 Dec 2023 05:48:13 +0000 (11:18 +0530)
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>
fs/xfs/xfs_rtalloc.c

index c52f479e3abd3541a307a2bc03212e2264b4c2c4..774e55cd602f3bcfde0a86a1ad365140e4feb1b5 100644 (file)
@@ -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;