From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 400583E1689; Wed, 20 May 2026 12:37:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779280672; cv=none; b=qJIWoPVTMzTq7u92AsmFkjH07hHNBn8JcgTBsf9UQ8KKW0Vd04JcKxWyE5cECBbSLkrQhs12fVGioJawuuKtgOuAtkHYVMqhzuvNDm/eN/f/bQnURtt2P38UDY4QWXSyHV2PYlSOTKjipg2YZV7+brF5HmUE2fQiuoiZRaES1xE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779280672; c=relaxed/simple; bh=1YGKwRWSwDpwL0zPksrmqnNVlgXD5DrMzp6PtbmNMqs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PaZ9WPnlE1UMiSzJewrdWSbWCA2iQPT0kO38qzxRJv0eLAlPMJE52R4LppkK51xNhuGYdoXNVFguwlbo9UyqVc/3YniF7/PyOL2rI1sOU2Pqjjccw7k+jkfs7oMYBYWoMF5SGEmJ7WibuVfdNWHpwaeXtetD6hpmcncrGTPgchc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YZW53TEQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YZW53TEQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84C1E1F000E9; Wed, 20 May 2026 12:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779280670; bh=HzdcyfQPNerVORYm1bBgmiQ6yYyGFk9EgoKl05CxMyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YZW53TEQcamrcSJeuP8xVdiBhGLi/o/4IHVdtbH4S3GGk9uYKEMn8PGxsZ8JDjwgn svt/50otd+fBBnsYluQwsOVExQjhfwh87goTxxAAIkX3jFm7jyy5fuqFHerrTbrGlJ RRNtIc14qmEs0C/H8JZjiko2Z5mnS+6ZBSrJT6ys7OwgLMBYsl+dwMasPZwaLkepzf lV8nVOeYm+2T5j86bI6ml2JFF4erDNAlgcHbGGoTGOY4zwE824nJoh+C1NxOfwbNVf WxOYYe0PWHaun2sK0+sWPfC4GxtN52NCxGFf3+XMmlUhLPwmXlQ9oAv/CNVWvXV/td 50H+T+3xztDpA== From: Andrey Albershteyn To: linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, ebiggers@kernel.org Cc: Andrey Albershteyn , hch@lst.de, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-btrfs@vger.kernel.org, linux-unionfs@vger.kernel.org, djwong@kernel.org Subject: [PATCH v10 09/22] iomap: introduce iomap_fsverity_write() for writing fsverity metadata Date: Wed, 20 May 2026 14:37:07 +0200 Message-ID: <20260520123722.405752-10-aalbersh@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20260520123722.405752-1-aalbersh@kernel.org> References: <20260520123722.405752-1-aalbersh@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This is just a wrapper around iomap_file_buffered_write() to create necessary iterator over metadata. Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong 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 1c66a1c362a7..eed646d7eb48 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 94afe4e170d0..5517bd9622ca 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 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 CBD84CD5BA4 for ; Wed, 20 May 2026 12:38:07 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:To:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=P6G73SrAshBHZDzb2+J/rTS6AqfaXrtNTlK0Du1Sspw=; b=F6rM9gfRmBzQdVY6vXnzOsAbtU b0/rlEryeOwT3m8u4DV7lf2r9khPGmOTmx4/Pby6Uog7HLDNoyoMg6CSxu9KqfqzmFnv2flRIY6Ou ltr2FMDupcRvk/xFz8K54Fg/6L/MtSfNddk7ONYYyHzBYSkCRCbKJETF5aJvKK7epDBE=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wPgBZ-0007OA-UC; Wed, 20 May 2026 12:38:06 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wPgBV-0007Ng-8F for linux-f2fs-devel@lists.sourceforge.net; Wed, 20 May 2026 12:38:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: 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=HzdcyfQPNerVORYm1bBgmiQ6yYyGFk9EgoKl05CxMyA=; b=bjOOMtU9xI+voxjrOlJ7GQcAKh fHuNLYrm83aYft+LA5avs1tqLNm6b675g35BY1ya+aW2jkPnkKffATVY52cvbg4hwIkfQJapbNlfC rUaY3ryG29AUvDT+LuCq4NuZEzMyeq11p90IT+GfE9SfSysuX3PJR7MTTjlJpMT6fXLU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: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=HzdcyfQPNerVORYm1bBgmiQ6yYyGFk9EgoKl05CxMyA=; b=hNU5TsptQvORRYcs+bh/WaXHyU ogLyIZ4XS7+ItohfZHIXnsuOVHDSoxP9Ry8EP24GWqQpCMH3llzszct48Tx/8Z57zrPP8SUUSn+TY hTjTZ6M6YzfJxjy31xsyqZ06MuJVoNoAixoZxSeCs5Qmdg0GuDVmDNU+9CgaZGAKICnk=; 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 1wPgBU-0006ZK-U5 for linux-f2fs-devel@lists.sourceforge.net; Wed, 20 May 2026 12:38:01 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D3EF560145; Wed, 20 May 2026 12:37:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84C1E1F000E9; Wed, 20 May 2026 12:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779280670; bh=HzdcyfQPNerVORYm1bBgmiQ6yYyGFk9EgoKl05CxMyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YZW53TEQcamrcSJeuP8xVdiBhGLi/o/4IHVdtbH4S3GGk9uYKEMn8PGxsZ8JDjwgn svt/50otd+fBBnsYluQwsOVExQjhfwh87goTxxAAIkX3jFm7jyy5fuqFHerrTbrGlJ RRNtIc14qmEs0C/H8JZjiko2Z5mnS+6ZBSrJT6ys7OwgLMBYsl+dwMasPZwaLkepzf lV8nVOeYm+2T5j86bI6ml2JFF4erDNAlgcHbGGoTGOY4zwE824nJoh+C1NxOfwbNVf WxOYYe0PWHaun2sK0+sWPfC4GxtN52NCxGFf3+XMmlUhLPwmXlQ9oAv/CNVWvXV/td 50H+T+3xztDpA== To: linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, ebiggers@kernel.org Date: Wed, 20 May 2026 14:37:07 +0200 Message-ID: <20260520123722.405752-10-aalbersh@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20260520123722.405752-1-aalbersh@kernel.org> References: <20260520123722.405752-1-aalbersh@kernel.org> MIME-Version: 1.0 X-Headers-End: 1wPgBU-0006ZK-U5 Subject: [f2fs-dev] [PATCH v10 09/22] 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: Andrey Albershteyn via Linux-f2fs-devel Reply-To: Andrey Albershteyn Cc: Andrey Albershteyn , djwong@kernel.org, linux-unionfs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, 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 This is just a wrapper around iomap_file_buffered_write() to create necessary iterator over metadata. Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong 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 1c66a1c362a7..eed646d7eb48 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 94afe4e170d0..5517bd9622ca 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 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel