Hi all, Historically, when users ran out of space or quota when trying to write to the filesystem, XFS didn't try very hard to reclaim space that it might have speculatively allocated for the purpose of speeding up front-end filesystem operations (appending writes, cow staging). The upcoming deferred inactivation series will greatly increase the amount of allocated space that isn't actively being used to store user data. Therefore, try to reduce the circumstances where we return EDQUOT or ENOSPC to userspace by teaching the write paths to try to clear space and retry the operation one time before giving up. v2: clean up and rebase against 5.11. v3: restructure the retry loops per dchinner suggestion If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below. This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=reclaim-space-harder-5.12 --- fs/xfs/libxfs/xfs_attr.c | 10 ++ fs/xfs/libxfs/xfs_bmap.c | 10 ++ fs/xfs/xfs_bmap_util.c | 22 +++-- fs/xfs/xfs_file.c | 26 ++++-- fs/xfs/xfs_icache.c | 189 +++++++++++++++++++++++++++++++--------------- fs/xfs/xfs_icache.h | 9 ++ fs/xfs/xfs_inode.c | 22 ++++- fs/xfs/xfs_ioctl.c | 18 +++- fs/xfs/xfs_iomap.c | 24 ++++-- fs/xfs/xfs_iops.c | 20 +++-- fs/xfs/xfs_qm.c | 36 +++++++-- fs/xfs/xfs_quota.h | 36 +++++---- fs/xfs/xfs_reflink.c | 31 +++++--- fs/xfs/xfs_symlink.c | 12 ++- fs/xfs/xfs_trace.c | 1 fs/xfs/xfs_trace.h | 40 ++++++++++ fs/xfs/xfs_trans.c | 20 +++++ fs/xfs/xfs_trans_dquot.c | 108 +++++++++++++++++++++++--- 18 files changed, 466 insertions(+), 168 deletions(-)