Re: [PATCH 08/14] xfs: queue inactivation immediately when free realtime extents are tight

Dave Chinner
2021-08-05T05:36:30Z

On Wed, Aug 04, 2021 at 07:07:06PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Now that we have made the inactivation of unlinked inodes a background
> task to increase the throughput of file deletions, we need to be a
> little more careful about how long of a delay we can tolerate.
>
> Similar to the patch doing this for free space on the data device, if
> the file being inactivated is a realtime file and the realtime volume is
> running low on free extents, we want to run the worker ASAP so that the
> realtime allocator can make better decisions.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> fs/xfs/xfs_icache.c | 24 ++++++++++++++++++++++++
> fs/xfs/xfs_mount.c | 13 ++++++++-----
> fs/xfs/xfs_mount.h | 3 ++-
> 3 files changed, 34 insertions(+), 6 deletions(-)
>
>
> diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
> index e5e90f09bcc6..4a062cf689c3 100644
> --- a/fs/xfs/xfs_icache.c
> +++ b/fs/xfs/xfs_icache.c
> @@ -1924,6 +1924,27 @@ xfs_inodegc_start(
> xfs_inodegc_queue_all(mp);
> }
>
> +#ifdef CONFIG_XFS_RT
> +static inline bool
> +xfs_inodegc_want_queue_rt_file(
> + struct xfs_inode *ip)
> +{
> + struct xfs_mount *mp = ip->i_mount;
> + uint64_t freertx;
> +
> + if (!XFS_IS_REALTIME_INODE(ip))
> + return false;
> +
> + spin_lock(&mp->m_sb_lock);
> + freertx = mp->m_sb.sb_frextents;
> + spin_unlock(&mp->m_sb_lock);

READ_ONCE() is probably sufficient here. We're not actually
serialising this against any specific operation, so I don't think
the lock is necessary to sample the value.

Other than that, all good.

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

--
Dave Chinner
david@fromorbit.com