Re: [f2fs-dev] [PATCH 08/11] ext4: consolidate fsverity_info lookup

Darrick J. Wong via Linux-f2fs-devel
2026-01-23T07:25:33Z

On Fri, Jan 23, 2026 at 06:18:36AM +0100, Christoph Hellwig wrote:
> On Thu, Jan 22, 2026 at 01:54:57PM -0800, Darrick J. Wong wrote:
> > > + if (folio->index <
> > > + DIV_ROUND_UP(inode->i_size, PAGE_SIZE))
> >
> > I keep seeing this predicate, maybe it should go into fsverity.h as a
> > helper function with the comment about mmap that I was muttering about
> > in the previous patch?
>
> Right now it is not generic. Nothing in the generic fsverity code
> known about the offset, ext4 and f2fs just happened to chose the
> same constant (and the ext4 one leak to buffer.c), while btrfs stores
> the verity hashed totally differently. I hope the xfs works ends up
> with a consolidated way of doing this, at which point such a helper
> would be useful.
>
> > Or maybe a "get verity info for given folio index" helper?
>
> How would that make sense?
>
> > /*
> > * Grab the fsverity context needed to verify the contents of the folio.
> > *
> > *
> > */
> > static inline struct fsverity_info *vi
> > fsverity_folio_info(const struct folio *folio)
> > {
> > struct inode *inode = folio->mapping->host;
> >
> > if (folio->index < DIV_ROUND_UP(inode->i_size, PAGE_SIZE))
> > return fsverity_get_info(inode);
> > return NULL;
> > }
>
> Tthe offset right now is entirely file system specific,
> so we can't do this. Maybe that'll change with further consolidation.

<nod> Ok, I think I'll defer all this talk of helpers until whichever
series cleans up all the post-eof pagecache stuff, and then we can make
all four filesystems pick the same offset for the cached merkle trees.

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D