Re: [PATCH 14/29] xfs: create a per-mount shrinker for verity inodes merkle tree blocks

Eric Biggers
2024-04-05T03:16:48Z

On Fri, Mar 29, 2024 at 05:39:43PM -0700, Darrick J. Wong wrote:
> +/* Count the merkle tree blocks that we might be able to reclaim. */
> +static unsigned long
> +xfs_fsverity_shrinker_count(
> + struct shrinker *shrink,
> + struct shrink_control *sc)
> +{
> + struct xfs_mount *mp = shrink->private_data;
> + s64 count;
> +
> + if (!xfs_has_verity(mp))
> + return SHRINK_EMPTY;
> +
> + count = percpu_counter_sum_positive(&mp->m_verity_blocks);
> +
> + trace_xfs_fsverity_shrinker_count(mp, count, _RET_IP_);
> + return min_t(s64, ULONG_MAX, count);

On 64-bit systems this always returns ULONG_MAX.

- Eric