Re: [PATCH v3 09/28] fsverity: pass log_blocksize to end_enable_verity()

Andrey Albershteyn
2023-10-11T11:18:37Z

On 2023-10-10 20:19:06, Eric Biggers wrote:
> On Fri, Oct 06, 2023 at 08:49:03PM +0200, Andrey Albershteyn wrote:
> > diff --git a/include/linux/fsverity.h b/include/linux/fsverity.h
> > index 252b2668894c..cac012d4c86a 100644
> > --- a/include/linux/fsverity.h
> > +++ b/include/linux/fsverity.h
> > @@ -51,6 +51,7 @@ struct fsverity_operations {
> > * @desc: the verity descriptor to write, or NULL on failure
> > * @desc_size: size of verity descriptor, or 0 on failure
> > * @merkle_tree_size: total bytes the Merkle tree took up
> > + * @log_blocksize: log size of the Merkle tree block
> > *
> > * If desc == NULL, then enabling verity failed and the filesystem only
> > * must do any necessary cleanups. Else, it must also store the given
> > @@ -65,7 +66,8 @@ struct fsverity_operations {
> > * Return: 0 on success, -errno on failure
> > */
> > int (*end_enable_verity)(struct file *filp, const void *desc,
> > - size_t desc_size, u64 merkle_tree_size);
> > + size_t desc_size, u64 merkle_tree_size,
> > + u8 log_blocksize);
>
> Maybe just pass the block_size itself instead of log2(block_size)?

XFS will still do `index << log2(block_size)` to get block's offset.
So, not sure if there's any difference.

--
- Andrey