On Fri, Mar 29, 2024 at 05:35:17PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > Compute the hash of a data block full of zeros, and then supply this to > the merkle tree read and write methods. A subsequent xfs patch will use This should say "hash of a block", not "hash of a data block". What you actually care about is the hash of a Merkle tree block, not the hash of a data block. Yet, there is no difference in how the hashes are calculated for the two types of blocks, so we should simply write "hash of a block". > diff --git a/fs/verity/fsverity_private.h b/fs/verity/fsverity_private.h > index de8798f141d4a..195a92f203bba 100644 > --- a/fs/verity/fsverity_private.h > +++ b/fs/verity/fsverity_private.h > @@ -47,6 +47,8 @@ struct merkle_tree_params { > u64 tree_size; /* Merkle tree size in bytes */ > unsigned long tree_pages; /* Merkle tree size in pages */ > > + u8 zero_digest[FS_VERITY_MAX_DIGEST_SIZE]; /* hash of zeroed data block */ Similarly, "block" instead of "data block". > diff --git a/include/linux/fsverity.h b/include/linux/fsverity.h > index 5dacd30d65353..761a0b76eefec 100644 > --- a/include/linux/fsverity.h > +++ b/include/linux/fsverity.h > @@ -66,6 +66,8 @@ struct fsverity_blockbuf { > * if the page at @block->offset isn't already cached. > * Implementations may ignore this argument; it's only a > * performance optimization. > + * @zero_digest: the hash for a data block of zeroes Likewise. > /** > @@ -81,12 +85,16 @@ struct fsverity_readmerkle { > * @level: level of the block; level 0 are the leaves > * @num_levels: number of levels in the tree total > * @log_blocksize: log2 of the size of the block > + * @zero_digest: the hash for a data block of zeroes > + * @digest_size: size of zero_digest Likewise. - Eric