[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260123051429.GB24123@lst.de>
Date: Fri, 23 Jan 2026 06:14:29 +0100
From: Christoph Hellwig <hch@....de>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: Christoph Hellwig <hch@....de>, Eric Biggers <ebiggers@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
David Sterba <dsterba@...e.com>, Theodore Ts'o <tytso@....edu>,
Jaegeuk Kim <jaegeuk@...nel.org>, Chao Yu <chao@...nel.org>,
Andrey Albershteyn <aalbersh@...hat.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
linux-fsdevel@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
fsverity@...ts.linux.dev
Subject: Re: [PATCH 05/11] fsverity: kick off hash readahead at data I/O
submission time
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.
Powered by blists - more mailing lists