diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2020-02-19 17:02:04 -0800 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2020-06-01 21:16:35 -0700 |
commit | 11ccd1f3e71f45a0223b95f1c0640ef688cf96f9 (patch) | |
tree | 931ace461b2fe63b24a13660d45ca426a91fd1a7 /fs/xfs/xfs_icache.c | |
parent | 72d96707db7e31a622fc27485bdb0a6ed5451ef0 (diff) |
xfs: flush speculative space allocations when we run out of quota
If a fs modification (creation, file write, reflink, etc.) is unable to
reserve enough quota to handle the modification, try clearing whatever
space the filesystem might have been hanging onto in the hopes of
speeding up the filesystem. The flushing behavior will become
particularly important when we add deferred inode inactivation because
that will increase the amount of space that isn't actively tied to user
data.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_icache.c')
-rw-r--r-- | fs/xfs/xfs_icache.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 8993a4ccb879..b1e598543b6e 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -1558,7 +1558,8 @@ xfs_icache_free_eofblocks( */ bool xfs_inode_free_quota_blocks( - struct xfs_inode *ip) + struct xfs_inode *ip, + bool sync) { struct xfs_eofblocks eofb = {0}; struct xfs_dquot *dq; @@ -1568,7 +1569,9 @@ xfs_inode_free_quota_blocks( * Run a sync scan to increase effectiveness and use the union filter to * cover all applicable quotas in a single scan. */ - eofb.eof_flags = XFS_EOF_FLAGS_UNION | XFS_EOF_FLAGS_SYNC; + eofb.eof_flags = XFS_EOF_FLAGS_UNION; + if (sync) + eofb.eof_flags |= XFS_EOF_FLAGS_SYNC; if (XFS_IS_UQUOTA_ENFORCED(ip->i_mount)) { dq = xfs_inode_dquot(ip, XFS_DQ_USER); @@ -1600,6 +1603,8 @@ xfs_inode_free_quota_blocks( if (!do_work) return false; + trace_xfs_inode_free_quota_blocks(ip->i_mount, &eofb, _RET_IP_); + xfs_icache_free_eofblocks(ip->i_mount, &eofb); xfs_icache_free_cowblocks(ip->i_mount, &eofb); return true; |