Commit 8babd8a2 authored by Dave Chinner's avatar Dave Chinner Committed by Alex Elder

xfs: Increase the default size of the reserved blocks pool

The current default size of the reserved blocks pool is easy to deplete
with certain workloads, in particular workloads that do lots of concurrent
delayed allocation extent conversions.  If enough transactions are running
in parallel and the entire pool is consumed then subsequent calls to
xfs_trans_reserve() will fail with ENOSPC.  Also add a rate limited
warning so we know if this starts happening again.

This is an updated version of an old patch from Lachlan McIlroy.
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
parent 3ed3a434
...@@ -1097,13 +1097,15 @@ xfs_default_resblks(xfs_mount_t *mp) ...@@ -1097,13 +1097,15 @@ xfs_default_resblks(xfs_mount_t *mp)
__uint64_t resblks; __uint64_t resblks;
/* /*
* We default to 5% or 1024 fsbs of space reserved, whichever is smaller. * We default to 5% or 8192 fsbs of space reserved, whichever is
* This may drive us straight to ENOSPC on mount, but that implies * smaller. This is intended to cover concurrent allocation
* we were already there on the last unmount. Warn if this occurs. * transactions when we initially hit enospc. These each require a 4
* block reservation. Hence by default we cover roughly 2000 concurrent
* allocation reservations.
*/ */
resblks = mp->m_sb.sb_dblocks; resblks = mp->m_sb.sb_dblocks;
do_div(resblks, 20); do_div(resblks, 20);
resblks = min_t(__uint64_t, resblks, 1024); resblks = min_t(__uint64_t, resblks, 8192);
return resblks; return resblks;
} }
...@@ -1417,6 +1419,9 @@ xfs_mountfs( ...@@ -1417,6 +1419,9 @@ xfs_mountfs(
* when at ENOSPC. This is needed for operations like create with * when at ENOSPC. This is needed for operations like create with
* attr, unwritten extent conversion at ENOSPC, etc. Data allocations * attr, unwritten extent conversion at ENOSPC, etc. Data allocations
* are not allowed to use this reserved space. * are not allowed to use this reserved space.
*
* This may drive us straight to ENOSPC on mount, but that implies
* we were already there on the last unmount. Warn if this occurs.
*/ */
if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
resblks = xfs_default_resblks(mp); resblks = xfs_default_resblks(mp);
...@@ -1725,26 +1730,30 @@ xfs_mod_incore_sb_unlocked( ...@@ -1725,26 +1730,30 @@ xfs_mod_incore_sb_unlocked(
lcounter += rem; lcounter += rem;
} }
} else { /* Taking blocks away */ } else { /* Taking blocks away */
lcounter += delta; lcounter += delta;
if (lcounter >= 0) {
mp->m_sb.sb_fdblocks = lcounter +
XFS_ALLOC_SET_ASIDE(mp);
return 0;
}
/* /*
* If were out of blocks, use any available reserved blocks if * We are out of blocks, use any available reserved
* were allowed to. * blocks if were allowed to.
*/ */
if (!rsvd)
return XFS_ERROR(ENOSPC);
if (lcounter < 0) {
if (rsvd) {
lcounter = (long long)mp->m_resblks_avail + delta; lcounter = (long long)mp->m_resblks_avail + delta;
if (lcounter < 0) { if (lcounter >= 0) {
return XFS_ERROR(ENOSPC);
}
mp->m_resblks_avail = lcounter; mp->m_resblks_avail = lcounter;
return 0; return 0;
} else { /* not reserved */
return XFS_ERROR(ENOSPC);
}
} }
printk_once(KERN_WARNING
"Filesystem \"%s\": reserve blocks depleted! "
"Consider increasing reserve pool size.",
mp->m_fsname);
return XFS_ERROR(ENOSPC);
} }
mp->m_sb.sb_fdblocks = lcounter + XFS_ALLOC_SET_ASIDE(mp); mp->m_sb.sb_fdblocks = lcounter + XFS_ALLOC_SET_ASIDE(mp);
......
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