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 | cd9cd0a830470a9510dbd63f986b9befae6c6d3c (patch) | |
tree | d123ed2b39eea8377c5fb67e89572097f6e109b0 /fs/xfs/xfs_inode.c | |
parent | 11ccd1f3e71f45a0223b95f1c0640ef688cf96f9 (diff) |
xfs: flush speculative space allocations when we run out of spacereclaim-space-harder_2020-06-01
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_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index a22cf9f6fe01..7de6443f0901 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -1160,10 +1160,18 @@ xfs_create( */ retry: error = xfs_trans_alloc(mp, tres, resblks, 0, 0, &tp); - if (error == -ENOSPC) { + /* + * We weren't able to reserve enough space to add the inode. Flush + * any disk space that was being held in the hopes of speeding up the + * filesystem. + */ + if (error == -ENOSPC && !cleared_space) { + cleared_space = true; /* flush outstanding delalloc blocks and retry */ xfs_flush_inodes(mp); - error = xfs_trans_alloc(mp, tres, resblks, 0, 0, &tp); + error = xfs_inode_free_blocks(mp, true); + if (!error) + goto retry; } if (error) goto out_release_inode; |