On Fri, Jan 23, 2026 at 06:14:29AM +0100, Christoph Hellwig wrote:
> On Thu, Jan 22, 2026 at 01:42:27PM -0800, Darrick J. Wong wrote:
> > > + if (first_folio) {
> > > + if (ext4_need_verity(inode, folio->index))
> > > + fsverity_readahead(folio, nr_pages);
> >
> > Ok, so here ext4 is trying to read a data page into memory, so we
> > initiate readahead on the merkle tree block(s) for that data page.
>
> Yes.
>
> > > + __fsverity_readahead(inode, vi, offset, last_index - index + 1);
> >
> > I went "Huh??" here until I realized that this is the function that
> > reads merkle tree content on behalf of some ioctl, so this is merely
> > starting readahead for that. Not sure anyone cares about throughput of
> > FS_VERITY_METADATA_TYPE_MERKLE_TREE but sure why not.
>
> It is trivial to provide and will make the ioctl read much faster.
>
> > > + const struct merkle_tree_params *params = &vi->tree_params;
> > > + u64 start_hidx = data_start_pos >> params->log_blocksize;
> > > + u64 end_hidx = (data_start_pos + ((nr_pages - 1) << PAGE_SHIFT)) >>
> > > + params->log_blocksize;
> >
> > I really wish these unit conversions had proper types and helpers
> > instead of this multiline to read shifting stuff. Oh well, you didn't
> > write it this way, you're just slicing and dicing.
>
> Agreed. Just not feeling like turning everything totally upside down
> right now :)
>
> > So if I read this correctly, we're initiating readahead of merkle tree
> > (leaf) data for the file data range starting at data_start_pos and
> > running for (nr_pages<<SHIFT) bytes? Then going another level up in the
> > merkle tree and initiating readahead for the corresponding interior
> > nodes until we get to the root?
>
> Yes. That's a difference to the old code that just did readahead
> for the leaf nodes.
Cool! In that case I think I understand what's going on here well
enough to say:
Reviewed-by: "Darrick J. Wong" <[email protected]>
--D
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel