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 v4: simplify the calling convention of xfs_trans_reserve_quota_nblks 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 | 8 +- fs/xfs/libxfs/xfs_bmap.c | 8 +- fs/xfs/xfs_bmap_util.c | 17 +++- fs/xfs/xfs_file.c | 21 ++--- fs/xfs/xfs_icache.c | 185 ++++++++++++++++++++++++++++++---------------- fs/xfs/xfs_icache.h | 7 +- fs/xfs/xfs_inode.c | 17 +++- fs/xfs/xfs_ioctl.c | 14 +++ fs/xfs/xfs_iomap.c | 19 ++++- fs/xfs/xfs_iops.c | 13 ++- fs/xfs/xfs_qm.c | 34 ++++++-- fs/xfs/xfs_quota.h | 41 ++++++---- fs/xfs/xfs_reflink.c | 16 +++- fs/xfs/xfs_symlink.c | 8 +- fs/xfs/xfs_trace.c | 1 fs/xfs/xfs_trace.h | 40 ++++++++++ fs/xfs/xfs_trans.c | 20 +++++ fs/xfs/xfs_trans_dquot.c | 109 +++++++++++++++++++++++---- 18 files changed, 430 insertions(+), 148 deletions(-)