From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2144A272816; Tue, 10 Mar 2026 01:02:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773104578; cv=none; b=LGsa4unt2RmoV6yjQ2+cZ4otwIZNy7s32FIi0gUb7k9sgNKTqgct6ozUag5PdGE/LR3fIpUNy3JybEUHdyYs6qIT6np//TxXWwu7DcMWLu6S4nPnSJLTbE5Z0qeGuUqzoI5aF/eN+tOF8HmpREmWT4l763HqVcpPo3p+Yz7/8AA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773104578; c=relaxed/simple; bh=RVuB7nL5vj0XzNceaDtFQbkVjrVe5Wkilj7bEZBUmyQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tJZFsO1QhADw8diHw/JeJU2PftkVRSVhERkYPziSwQIrDC3c7MKwcHm6e0fwUhqKxno0ysQoeBQPkztbEmkbKS1FSi/IXVi5vKJpC5X3u0n9J4DtV/i5+j4Qagtwyr8UQ/FqmxJrIj2o5zOnU7yXbq5VcD7yhWH6lhgGRz01wSE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UWmzXTk+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UWmzXTk+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67613C4CEF7; Tue, 10 Mar 2026 01:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773104577; bh=RVuB7nL5vj0XzNceaDtFQbkVjrVe5Wkilj7bEZBUmyQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UWmzXTk+6L3q58RyT+GHE41CHeJTsbgAe/+dNUeEwFjNs9jN8MjJVYSZdQTThvJMj DFpGf/XWW40M2u6nklyGk0UDhDZr3tIcfw8FRISggJCkfPzbEyoxM4buDPBDS6ke+N Jejt1Vzzk/k7PL7d7h28QF8ymTmRjSwDQIo2mHMgVGhCsQyh9qiTd7P4/6eKkXEj4N R3AmSSjy6qPwN4yhRvVJR1BqAA0kXWTpn5Bfox4k5rMP9/7EmNckrGttO+EhzBHjDo QDRNKO0G3CFPJyhj5VaYaatnvvbQtKo8x2R5tcBZmiKYmgbIuw/An8PWE2HE7B7QLJ Csx3ELQ4lAbCw== Date: Mon, 9 Mar 2026 18:02:56 -0700 From: "Darrick J. Wong" To: Andrey Albershteyn Cc: linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, ebiggers@kernel.org, hch@lst.de, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-btrfs@vger.kernel.org Subject: Re: [PATCH v4 11/25] iomap: introduce iomap_fsverity_write() for writing fsverity metadata Message-ID: <20260310010256.GA1105363@frogsfrogsfrogs> References: <20260309192355.176980-1-aalbersh@kernel.org> <20260309192355.176980-12-aalbersh@kernel.org> Precedence: bulk X-Mailing-List: fsverity@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260309192355.176980-12-aalbersh@kernel.org> On Mon, Mar 09, 2026 at 08:23:26PM +0100, Andrey Albershteyn wrote: > This is just a wrapper around iomap_file_buffered_write() to create > necessary iterator over metadata. > > Signed-off-by: Andrey Albershteyn > --- > 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 31e39ab93a2e..88fe4723bb22 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -1259,6 +1259,31 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i, > } > EXPORT_SYMBOL_GPL(iomap_file_buffered_write); > > +ssize_t 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; ret should be ssize_t. > + 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; Nit: If we're not returning the number of bytes written, then the return type of this function ought to be int, not ssize_t. Also ... if there's a short write, shouldn't we return some sort of error instead of zero for success? ssize_t written = iomap_file_buffered_write(...); if (written < 0) return written; return ret == length ? 0 : -EIO; --D > + return 0; > +} > +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 89e5a7abc012..844fc8414363 100644 > --- a/include/linux/iomap.h > +++ b/include/linux/iomap.h > @@ -356,6 +356,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); > +ssize_t 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 > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52C53FCC9A5 for ; Tue, 10 Mar 2026 01:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:In-Reply-To:MIME-Version:References: Message-ID:To:Date:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bRjMPSpASvb2Ts+YBLAB8vS5TwT8fSTEsw1WxZVee9Y=; b=N7x3ZUcWhRZlBTTt3rTOwP+V3O Kvptg7b9VLfr8qFfJMood2W5J0v1dWfnMprLSaeZI2NCR1+WUN9qP9qfXPwphb8362wp6CMkHosvQ iouchIDrx1uPQXNF95hWTgbS5ADat3fg6zEYFwwOFw/LVXCwyrTtkuKGC0kq0I8y/9+k=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vzlV7-0000Is-Rw; Tue, 10 Mar 2026 01:03:09 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vzlV7-0000Ik-08 for linux-f2fs-devel@lists.sourceforge.net; Tue, 10 Mar 2026 01:03:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=OBKnppm+MuPhdo9LP2ejPB2yenBqD0DqsdfHN+DET18=; b=afKQItExK/6nWmEHEgVJYgcR6w Pb1E3KEhn8fR1dHxn0FevLd8992pbSDzgSEZUbpPp8u4payau36EtoUaZ66EiOPBK6w+oYCfOv3pu dZ648sD1IANEzSvxLCiiPsskthiizdakTSIuOXLPcYG5rM+1NG6sGSkYuk6kF5B5NOxI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=OBKnppm+MuPhdo9LP2ejPB2yenBqD0DqsdfHN+DET18=; b=NjHDmUsd4kbhvuYct9YLGXKd8T W9D/FZtF3qWoWGIYzVE4xaOeNi1k5mdrT6fQcjzAtRhSvuQE/fogYB6XqiBi3sDXcfExpeMinAEid fzphR3oPGEcwpNy8O6E1X3Dcd3VR+Qfqq1AEtBDshQpk7pdaq6P9EsKt7pgWbsp2nQtM=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vzlV6-00077n-Ew for linux-f2fs-devel@lists.sourceforge.net; Tue, 10 Mar 2026 01:03:08 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id BA34860097; Tue, 10 Mar 2026 01:02:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67613C4CEF7; Tue, 10 Mar 2026 01:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773104577; bh=RVuB7nL5vj0XzNceaDtFQbkVjrVe5Wkilj7bEZBUmyQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UWmzXTk+6L3q58RyT+GHE41CHeJTsbgAe/+dNUeEwFjNs9jN8MjJVYSZdQTThvJMj DFpGf/XWW40M2u6nklyGk0UDhDZr3tIcfw8FRISggJCkfPzbEyoxM4buDPBDS6ke+N Jejt1Vzzk/k7PL7d7h28QF8ymTmRjSwDQIo2mHMgVGhCsQyh9qiTd7P4/6eKkXEj4N R3AmSSjy6qPwN4yhRvVJR1BqAA0kXWTpn5Bfox4k5rMP9/7EmNckrGttO+EhzBHjDo QDRNKO0G3CFPJyhj5VaYaatnvvbQtKo8x2R5tcBZmiKYmgbIuw/An8PWE2HE7B7QLJ Csx3ELQ4lAbCw== Date: Mon, 9 Mar 2026 18:02:56 -0700 To: Andrey Albershteyn Message-ID: <20260310010256.GA1105363@frogsfrogsfrogs> References: <20260309192355.176980-1-aalbersh@kernel.org> <20260309192355.176980-12-aalbersh@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20260309192355.176980-12-aalbersh@kernel.org> X-Headers-End: 1vzlV6-00077n-Ew Subject: Re: [f2fs-dev] [PATCH v4 11/25] iomap: introduce iomap_fsverity_write() for writing fsverity metadata X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Darrick J. Wong via Linux-f2fs-devel" Reply-To: "Darrick J. Wong" Cc: fsverity@lists.linux.dev, ebiggers@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, hch@lst.de, linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Mon, Mar 09, 2026 at 08:23:26PM +0100, Andrey Albershteyn wrote: > This is just a wrapper around iomap_file_buffered_write() to create > necessary iterator over metadata. > > Signed-off-by: Andrey Albershteyn > --- > 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 31e39ab93a2e..88fe4723bb22 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -1259,6 +1259,31 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i, > } > EXPORT_SYMBOL_GPL(iomap_file_buffered_write); > > +ssize_t 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; ret should be ssize_t. > + 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; Nit: If we're not returning the number of bytes written, then the return type of this function ought to be int, not ssize_t. Also ... if there's a short write, shouldn't we return some sort of error instead of zero for success? ssize_t written = iomap_file_buffered_write(...); if (written < 0) return written; return ret == length ? 0 : -EIO; --D > + return 0; > +} > +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 89e5a7abc012..844fc8414363 100644 > --- a/include/linux/iomap.h > +++ b/include/linux/iomap.h > @@ -356,6 +356,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); > +ssize_t 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 > > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel