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

Darrick J. Wong
2024-04-24T17:39:04Z

On Thu, Apr 04, 2024 at 11:16:46PM -0400, Eric Biggers wrote:
> 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.

Oops, I think I meant u64 there. It's confusing to me that
percpu_counter_sum_positive returns a signed type. :(

--D

> - Eric
>