Re: [PATCH RFC 12/29] fsverity: expose merkle tree geometry to callers

Darrick J. Wong
2025-08-12T19:09:49Z

On Tue, Aug 12, 2025 at 09:42:08AM +0200, Christoph Hellwig wrote:
> On Mon, Aug 11, 2025 at 08:38:22AM -0700, Darrick J. Wong wrote:
> > > Just curious, why does xfs need this, but the existing file systems
> > > don't? That would be some good background information for the commit
> > > message.
> >
> > Hrmmm... the last time I sent this RFC, online fsck used it to check the
> > validity of the merkle tree xattrs.
>
> I saw a few users, so it does get used. But patches exporting something
> should in generaly document what the use case is.
>
> > > > + if (!IS_VERITY(inode))
> > > > + return -ENODATA;
> > > > +
> > > > + error = ensure_verity_info(inode);
> > > > + if (error)
> > > > + return error;
> > > > +
> > > > + vi = inode->i_verity_info;
> > >
> > > Wouldn't it be a better interface to return the verity_ino from
> > > ensure_verity_info (NULL for !IS_VERITY, ERR_PTR for real error)
> > > and then just look at the fields directly?
> >
> > They're private to fsverity_private.h.
>
> Indeed. Is ensure_verity_info ven the right thing here? I.e.
> should quering the paramters create the info if it wasn't there
> yet?

I think it's usually the case that we're about to access the merkle tree
anyway, so the next step in whatever we're doing would load it for us.

--D