On Wed, Dec 14, 2022 at 08:10:10AM +1100, Dave Chinner wrote: > On Tue, Dec 13, 2022 at 11:33:54AM -0800, Eric Biggers wrote: > > On Tue, Dec 13, 2022 at 05:55:22PM +0000, Matthew Wilcox wrote: > > > I'm happy to work with you to add support for large folios to verity. > > > It hasn't been high priority for me, but I'm now working on folio support > > > for bufferhead filesystems and this would probably fit in. > > > > I'd be very interested to know what else is needed after commit 98dc08bae678 > > ("fsverity: stop using PG_error to track error status") which is upstream now, > > and > > https://lore.kernel.org/linux-fsdevel/20221028224539.171818-1-ebiggers@xxxxxxxxxx/T/#u > > ("fsverity: support for non-4K pages") which is planned for 6.3. > > Did you change the bio interfaces to iterate a bvec full of > variable sized folios, or does it still expect a bio to only have > PAGE_SIZE pages attached to it? > You can take a look at fsverity_verify_bio() with https://lore.kernel.org/r/20221028224539.171818-2-ebiggers@xxxxxxxxxx applied. It uses bio_for_each_segment_all() to iterate through the bio's segments. For each segment, it verifies each data block in the segment, assuming bv_len and bv_offset are multiples of the Merkle tree block size. The file position of each data block is computed as '(page->index << PAGE_SHIFT) + bv_offset'. I suppose the issue is going to be that only the first page of a folio actually has an index. Using bio_for_each_folio_all() would avoid this problem, I think? - Eric