diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2019-08-02 14:14:47 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-08-10 09:58:00 -0700 |
commit | 4f4e08ea2f7b19e4a79553593503a8cce8b7b0d1 (patch) | |
tree | 26d17c81b48db5812630c642c2ac1f6fa8fd30bc /fs/xfs/xfs_bmap_util.c | |
parent | a6944ec8d1773d280a6c3f7fd1a9356af6a0edea (diff) |
xfs: flush speculative space allocations when we run out of spacereclaim-space-harder_2019-08-10
If a fs modification (creation, file write, reflink, etc.) is unable to
reserve enough space 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_bmap_util.c')
-rw-r--r-- | fs/xfs/xfs_bmap_util.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index f1f0b55fcd89..220c64a82303 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -944,7 +944,17 @@ xfs_alloc_file_space( retry: error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, resrtextents, 0, &tp); - + /* + * We weren't able to reserve enough space to handle fallocate. + * Flush any disk space that was being held in the hopes of + * speeding up the filesystem. We hold the IOLOCK so we cannot + * do a synchronous scan. + */ + if (error == -ENOSPC && !cleared_space) { + cleared_space = true; + xfs_inode_free_blocks(ip->i_mount, false); + goto retry; + } /* * Check for running out of space */ |