summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_rtalloc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index c774a4ccdd15..3aa9634a9e76 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -497,6 +497,9 @@ xfs_rtallocate_extent_near(
* allocating one.
*/
if (maxlog >= 0) {
+ xfs_extlen_t maxavail =
+ min_t(xfs_rtblock_t, maxlen,
+ (1ULL << (maxlog + 1)) - 1);
/*
* On the positive side of the starting location.
*/
@@ -506,7 +509,7 @@ xfs_rtallocate_extent_near(
* this block.
*/
error = xfs_rtallocate_extent_block(args,
- bbno + i, minlen, maxlen, len,
+ bbno + i, minlen, maxavail, len,
&n, prod, &r);
if (error) {
return error;
@@ -553,7 +556,7 @@ xfs_rtallocate_extent_near(
continue;
error = xfs_rtallocate_extent_block(args,
bbno + j, minlen,
- maxlen, len, &n, prod,
+ maxavail, len, &n, prod,
&r);
if (error) {
return error;
@@ -575,7 +578,7 @@ xfs_rtallocate_extent_near(
* that we found.
*/
error = xfs_rtallocate_extent_block(args,
- bbno + i, minlen, maxlen, len,
+ bbno + i, minlen, maxavail, len,
&n, prod, &r);
if (error) {
return error;