On Thu, Jan 22, 2026 at 02:04:20PM -0800, Darrick J. Wong wrote:
> On Thu, Jan 22, 2026 at 09:22:07AM +0100, Christoph Hellwig wrote:
> > Use the kernel's resizable hash table to find the fsverity_info. This
>
> Oh is that what the 'r' stands for? I thought it was rcu. Maybe it's
> both. :P
>From the lib/rhashtable.c:
* Resizable, Scalable, Concurrent Hash Table
> > Because insertation into the hash table now happens before S_VERITY is
> > set, fsverity just becomes a barrier and a flag check and doesn't have
> > to look up the fsverity_info at all, so there is only one two two
>
> "one two two" <confused>?
one or two, sorry. The cover letter actually explains this in more
detail, which this should be updated to.
> > +static const struct rhashtable_params fsverity_info_hash_params = {
> > + .key_len = sizeof(struct inode *),
>
> .key_len = sizeof_field(struct fsverity_info, inode),
>
> Perhaps?
That should work, yes.
> > - kfree(vi->tree_params.hashstate);
> > - kvfree(vi->hash_block_verified);
> > - kmem_cache_free(fsverity_info_cachep, vi);
> > + return rhashtable_lookup_fast(&fsverity_info_hash, &inode,
> > + fsverity_info_hash_params);
>
> Hrm. The rhashtable stores a pointer to the rhash_head, but now we're
> returning that as if it were a fsverity_info pointer. Can I be pedantic
> and ask for a proper container_of() to avoid leaving a landmine if the
> struct layout ever changes?
rhashtable_lookup_fast returns the struct containing the rhash_head.
The paramters store the rhead_offset for that purpose. See rht_obj
as used by rhashtable_lookup.
> > @@ -323,9 +323,9 @@ fsverity_init_verification_context(struct
> > fsverity_verification_context *ctx,
> > struct fsverity_info *vi)
> > {
> > ctx->inode = inode;
> > - ctx->vi = vi;
>
> Can this function drop its @vi argument?
No..
>
> > + ctx->vi = fsverity_get_info(inode);
... but this extra lookup should have been removed and got messed up by a
rebase, causing a pointless extra lookup. (Which still is completely
in the noise in my runs).
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel