aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/libxfs/xfs_alloc.c')
-rw-r--r--fs/xfs/libxfs/xfs_alloc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index bc3367b8b7bb..857a53e58b94 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -2042,6 +2042,7 @@ xfs_alloc_space_available(
2042 xfs_extlen_t alloc_len, longest; 2042 xfs_extlen_t alloc_len, longest;
2043 xfs_extlen_t reservation; /* blocks that are still reserved */ 2043 xfs_extlen_t reservation; /* blocks that are still reserved */
2044 int available; 2044 int available;
2045 xfs_extlen_t agflcount;
2045 2046
2046 if (flags & XFS_ALLOC_FLAG_FREEING) 2047 if (flags & XFS_ALLOC_FLAG_FREEING)
2047 return true; 2048 return true;
@@ -2054,8 +2055,13 @@ xfs_alloc_space_available(
2054 if (longest < alloc_len) 2055 if (longest < alloc_len)
2055 return false; 2056 return false;
2056 2057
2057 /* do we have enough free space remaining for the allocation? */ 2058 /*
2058 available = (int)(pag->pagf_freeblks + pag->pagf_flcount - 2059 * Do we have enough free space remaining for the allocation? Don't
2060 * account extra agfl blocks because we are about to defer free them,
2061 * making them unavailable until the current transaction commits.
2062 */
2063 agflcount = min_t(xfs_extlen_t, pag->pagf_flcount, min_free);
2064 available = (int)(pag->pagf_freeblks + agflcount -
2059 reservation - min_free - args->minleft); 2065 reservation - min_free - args->minleft);
2060 if (available < (int)max(args->total, alloc_len)) 2066 if (available < (int)max(args->total, alloc_len))
2061 return false; 2067 return false;