xfs: use background worker pool when transactions can't get free space
authorDarrick J. Wong <djwong@kernel.org>
Fri, 6 Aug 2021 18:05:42 +0000 (11:05 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 9 Aug 2021 18:13:16 +0000 (11:13 -0700)
commite8d04c2abcebd66bdbacd53bb273d824d4e27080
treeb416b3ed43c11685eac84c4205d806f6690be236
parent6f6490914d9b712004ddad648e47b1bf22647978
xfs: use background worker pool when transactions can't get free space

In xfs_trans_alloc, if the block reservation call returns ENOSPC, we
call xfs_blockgc_free_space with a NULL icwalk structure to try to free
space.  Each frontend thread that encounters this situation starts its
own walk of the inode cache to see if it can find anything, which is
wasteful since we don't have any additional selection criteria.  For
this one common case, create a function that reschedules all pending
background work immediately and flushes the workqueue so that the scan
can run in parallel.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/xfs_icache.c
fs/xfs/xfs_icache.h
fs/xfs/xfs_trace.h
fs/xfs/xfs_trans.c