Re: [PATCH v6 08/22] iomap: introduce iomap_fsverity_write() for writing fsverity metadata

Darrick J. Wong
2026-03-31T23:32:25Z

On Tue, Mar 31, 2026 at 11:28:09PM +0200, Andrey Albershteyn wrote:
> This is just a wrapper around iomap_file_buffered_write() to create
> necessary iterator over metadata.
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>

Looks good to me.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
> fs/iomap/buffered-io.c | 25 +++++++++++++++++++++++++
> include/linux/iomap.h | 3 +++
> 2 files changed, 28 insertions(+)
>
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index 7ac319618f8e..0f89225dc3d7 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -1287,6 +1287,31 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i,
> }
> EXPORT_SYMBOL_GPL(iomap_file_buffered_write);
>
> +int iomap_fsverity_write(struct file *file, loff_t pos, size_t length,
> + const void *buf, const struct iomap_ops *ops,
> + const struct iomap_write_ops *write_ops)
> +{
> + int ret;
> + struct iov_iter iiter;
> + struct kvec kvec = {
> + .iov_base = (void *)buf,
> + .iov_len = length,
> + };
> + struct kiocb iocb = {
> + .ki_filp = file,
> + .ki_ioprio = get_current_ioprio(),
> + .ki_pos = pos,
> + };
> +
> + iov_iter_kvec(&iiter, WRITE, &kvec, 1, length);
> +
> + ret = iomap_file_buffered_write(&iocb, &iiter, ops, write_ops, NULL);
> + if (ret < 0)
> + return ret;
> + return ret == length ? 0 : -EIO;
> +}
> +EXPORT_SYMBOL_GPL(iomap_fsverity_write);
> +
> static void iomap_write_delalloc_ifs_punch(struct inode *inode,
> struct folio *folio, loff_t start_byte, loff_t end_byte,
> struct iomap *iomap, iomap_punch_t punch)
> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
> index 4d9202cae29f..83586f09f365 100644
> --- a/include/linux/iomap.h
> +++ b/include/linux/iomap.h
> @@ -359,6 +359,9 @@ static inline bool iomap_want_unshare_iter(const struct iomap_iter *iter)
> ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
> const struct iomap_ops *ops,
> const struct iomap_write_ops *write_ops, void *private);
> +int iomap_fsverity_write(struct file *file, loff_t pos, size_t length,
> + const void *buf, const struct iomap_ops *ops,
> + const struct iomap_write_ops *write_ops);
> void iomap_read_folio(const struct iomap_ops *ops,
> struct iomap_read_folio_ctx *ctx, void *private);
> void iomap_readahead(const struct iomap_ops *ops,
> --
> 2.51.2
>
>