Re: [PATCH 12/14] xfs: use background worker pool when transactions can't get free space

Dave Chinner
2021-08-05T05:42:05Z

On Wed, Aug 04, 2021 at 07:07:28PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> 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>
> ---
> fs/xfs/xfs_icache.c | 28 ++++++++++++++++++++++++++++
> fs/xfs/xfs_icache.h | 1 +
> fs/xfs/xfs_trace.h | 1 +
> fs/xfs/xfs_trans.c | 5 +----
> 4 files changed, 31 insertions(+), 4 deletions(-)

Yup, looks a bit more efficient to do it this way.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

--
Dave Chinner
david@fromorbit.com