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

xfs: reflow the tail end of xfs_rtallocate_extent_block

Change polarity of a check so that the successful case of being able to
allocate an extent is in the main path of the function and error handling
is on a branch.
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 f3e509dd
...@@ -289,16 +289,24 @@ xfs_rtallocate_extent_block( ...@@ -289,16 +289,24 @@ xfs_rtallocate_extent_block(
if (error) if (error)
return error; return error;
} }
/* /*
* Searched the whole thing & didn't find a maxlen free extent. * Searched the whole thing & didn't find a maxlen free extent.
*/ */
if (minlen <= maxlen && besti != -1) { if (minlen > maxlen || besti == -1) {
xfs_rtxlen_t p; /* amount to trim length by */ /*
* Allocation failed. Set *nextp to the next block to try.
*/
*nextp = next;
return -ENOSPC;
}
/* /*
* If size should be a multiple of prod, make that so. * If size should be a multiple of prod, make that so.
*/ */
if (prod > 1) { if (prod > 1) {
xfs_rtxlen_t p; /* amount to trim length by */
div_u64_rem(bestlen, prod, &p); div_u64_rem(bestlen, prod, &p);
if (p) if (p)
bestlen -= p; bestlen -= p;
...@@ -313,12 +321,6 @@ xfs_rtallocate_extent_block( ...@@ -313,12 +321,6 @@ xfs_rtallocate_extent_block(
*len = bestlen; *len = bestlen;
*rtx = besti; *rtx = besti;
return 0; return 0;
}
/*
* Allocation failed. Set *nextp to the next block to try.
*/
*nextp = next;
return -ENOSPC;
} }
/* /*
......
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