{"id":2221456,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2221456/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260409131404.1545834-8-aalbersh@kernel.org/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.2/projects/8/?format=json","name":"Linux ext4 filesystem development","link_name":"linux-ext4","list_id":"linux-ext4.vger.kernel.org","list_email":"linux-ext4@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260409131404.1545834-8-aalbersh@kernel.org>","list_archive_url":null,"date":"2026-04-09T13:13:39","name":"[v7,07/22] iomap: introduce IOMAP_F_FSVERITY and teach writeback to handle fsverity","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"fc951fdce1804572ece3a86f722b2a85a1e5b628","submitter":{"id":92821,"url":"http://patchwork.ozlabs.org/api/1.2/people/92821/?format=json","name":"Andrey Albershteyn","email":"aalbersh@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260409131404.1545834-8-aalbersh@kernel.org/mbox/","series":[{"id":499292,"url":"http://patchwork.ozlabs.org/api/1.2/series/499292/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=499292","date":"2026-04-09T13:13:34","name":"fs-verity support for XFS with post EOF merkle tree","version":7,"mbox":"http://patchwork.ozlabs.org/series/499292/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221456/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221456/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <SRS0=DQoX=CI=vger.kernel.org=linux-ext4+bounces-15704-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ext4@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=eq2+JrG+;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=dqox=ci=vger.kernel.org=linux-ext4+bounces-15704-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c04:e001:36c::12fc:5321\"\n arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org","gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=eq2+JrG+;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15704-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"eq2+JrG+\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fs0tX4gwMz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 23:20:52 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fs0tX48GBz4wLM\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 23:20:52 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4fs0tX42hWz4wLh; Thu, 09 Apr 2026 23:20:52 +1000 (AEST)","from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4fs0tS6xQLz4wLM\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 09 Apr 2026 23:20:48 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 32C6F306F956\n\tfor <patchwork-incoming@ozlabs.org>; Thu,  9 Apr 2026 13:15:54 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 4725D3D649C;\n\tThu,  9 Apr 2026 13:14:33 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 51A543D4116;\n\tThu,  9 Apr 2026 13:14:32 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 57344C19424;\n\tThu,  9 Apr 2026 13:14:29 +0000 (UTC)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775740852; cv=pass;\n\tb=HPaZFu0rP+vuQAzzdpeCyOfwxmWPiQ1fMyA4pnq73XWlgyCa9YNJn24eG0zzPX3eLB2LkoNfTFphzag665HE9GqbgHzFpcvOzdaT73+wi7Ot/BMTM9/577K9B+f3X9V2Q3Du5vnhcVeznMaInw/xUS4MACZb6riVkJ9C7T3xFd+7ZssmO9cJj9kTz5ZK7RnrRKya3KFGzB/b9cTQIIrSaaiA9GLMr00BBoM3rrow5NBQ65Y6pHEHRDI3EbjVOT4ECCZZstezPKFcnc1IzWWvP6biqV0Dl1AJyOTIbRt6HHmoj8QlAH/45jBE1WXv/8+SoT08W1Sj0/8xzLtB4HfZCA==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775740472; cv=none;\n b=ewiQF4BXwuT0lh1gkmQ0OIgyXb/2GEu3qIoVqNPQOEYPHrBKC27uyPOT9U+bxcVK3A3YEfrX79YBwUYbT6Ak+ey69hEJcOKc+LSOCmxFgmS75g2V37S+Ehs4FyuF/I3Ip+Rqu2ZJkX9HcZxfkxmwg/G+1PjTKrKGZ/MpsOltIeY="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775740852; c=relaxed/relaxed;\n\tbh=+s3LLv/+V56VWDIFjPTlfRXdYQQ9ar2ORxIzAazcJeI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=buJhAuGwtJ/nckxuWo6P4CQGw2VsskxUx6oC5eKt1ENd3jI7LBB/ESpQPOW5YtBGTxvkNfu2hqJEdkRAQvTJt/jADnOoji+HyY3K2y8XZLSrauTJVtnviPqkqbSFV/inO5DPbnxmH3ASIm2+vlo9J5OVHlt252P/YFV1++g+NDe09DwKmIqD+RFn5R9TAmyNko0BDtNDR6h0PLc53WBIMnNwXyHSCAg3QPlLOeLG8fx1TictYSDY5nHvgyH+h+savBltDb6sKd+C+sHFYrNoyk/43zItFnTWR3Ex6Ehgz7AGWo9dvKNFzs64CKl4FPI/4k4Dvzze02TsX8wn75ZuZg==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775740472; c=relaxed/simple;\n\tbh=Eaaq0hH8g1nljZhSJeNsb1Z/i9y2O7ArKbTh9ZdwoXg=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=otU56RUInJD9VYFT4pmB1VEVYMy13vCVo6u4vcxJJGfDN49FJ5zSPJCnrM6WhtbKvvyC4V5MzEG63sRq6zscaZ2Gl8JYsAxKGphvEoGZSbOjZsEg5F8V974/lMKbFMh9X8Inr3syRKj32EE8+x2/9KnHv30JYLQyCY4fdspebuU="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=eq2+JrG+; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15704-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=eq2+JrG+; arc=none smtp.client-ip=10.30.226.201"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1775740471;\n\tbh=Eaaq0hH8g1nljZhSJeNsb1Z/i9y2O7ArKbTh9ZdwoXg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=eq2+JrG+XNJ1FAJb9o2aCpLb1MP0+xtnR+BJ6pAXQODqN5G4Toz7xqwiRWi2BLzog\n\t mS4MS8EEZh7jjwPvJ4Uo4hj62TcjmtXwbpmtzAg0IewqJiBjBrlW5rcAMxNgTNV+hv\n\t WhpL25xyM3zVz/Qx0RZs+ZVbfeagScDs8g696oQfRT8/0xuWaZJMGoIyKztKM/ZKkj\n\t sY3fpzBHwXubgFGRXAFQrk+nczQrxjDdlg91QrGMoOAcc9LF4B8zjBJvf/DQf4QauK\n\t UtymxPF99l9ruSPxjtVDprQZ+2gv2dOcvN3Na5eL3Wrka6/sBx5wq5Ohrpn/+lEuW2\n\t hF13gBN6InBcg==","From":"Andrey Albershteyn <aalbersh@kernel.org>","To":"linux-xfs@vger.kernel.org,\n\tfsverity@lists.linux.dev,\n\tlinux-fsdevel@vger.kernel.org,\n\tebiggers@kernel.org","Cc":"Andrey Albershteyn <aalbersh@kernel.org>,\n\thch@lst.de,\n\tlinux-ext4@vger.kernel.org,\n\tlinux-f2fs-devel@lists.sourceforge.net,\n\tlinux-btrfs@vger.kernel.org,\n\tdjwong@kernel.org","Subject":"[PATCH v7 07/22] iomap: introduce IOMAP_F_FSVERITY and teach\n writeback to handle fsverity","Date":"Thu,  9 Apr 2026 15:13:39 +0200","Message-ID":"<20260409131404.1545834-8-aalbersh@kernel.org>","X-Mailer":"git-send-email 2.51.2","In-Reply-To":"<20260409131404.1545834-1-aalbersh@kernel.org>","References":"<20260409131404.1545834-1-aalbersh@kernel.org>","Precedence":"bulk","X-Mailing-List":"linux-ext4@vger.kernel.org","List-Id":"<linux-ext4.vger.kernel.org>","List-Subscribe":"<mailto:linux-ext4+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ext4+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Spam-Status":"No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"},"content":"This flag indicates that I/O is for fsverity metadata.\n\nIn the write path skip i_size check and i_size updates as metadata is\npast EOF. In writeback don't update i_size and continue writeback if\neven folio is beyond EOF. In read path don't zero fsverity folios, again\nthey are past EOF.\n\nThe iomap_block_needs_zeroing() is also called from write path. For\nfolios of larger order we don't want to zero out pages in the folio as\nthese could contain other merkle tree blocks. For fsverity, filesystem\nwill request to read PAGE_SIZE memory regions. For data folios, iomap\nwill zero the rest of the folio for anything which is beyond EOF. We\ndon't want this for fsverity folios.\n\nSigned-off-by: Andrey Albershteyn <aalbersh@kernel.org>\nReviewed-by: \"Darrick J. Wong\" <djwong@kernel.org>\n---\n fs/iomap/buffered-io.c | 43 +++++++++++++++++++++++++++++++++---------\n fs/iomap/trace.h       |  3 ++-\n include/linux/iomap.h  |  8 ++++++++\n 3 files changed, 44 insertions(+), 10 deletions(-)","diff":"diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c\nindex e4b6886e5c3c..38c9592fba43 100644\n--- a/fs/iomap/buffered-io.c\n+++ b/fs/iomap/buffered-io.c\n@@ -353,9 +353,26 @@ static inline bool iomap_block_needs_zeroing(const struct iomap_iter *iter,\n {\n \tconst struct iomap *srcmap = iomap_iter_srcmap(iter);\n \n-\treturn srcmap->type != IOMAP_MAPPED ||\n-\t\t(srcmap->flags & IOMAP_F_NEW) ||\n-\t\tpos >= i_size_read(iter->inode);\n+\t/*\n+\t * If this block has not been written, there's nothing to read\n+\t */\n+\tif (srcmap->type != IOMAP_MAPPED)\n+\t\treturn true;\n+\n+\t/*\n+\t * Newly allocated blocks have not been written\n+\t */\n+\tif (srcmap->flags & IOMAP_F_NEW)\n+\t\treturn true;\n+\n+\t/*\n+\t * fsverity metadata is stored past i_size, we need to read it instead\n+\t * of zeroing\n+\t */\n+\tif (srcmap->flags & IOMAP_F_FSVERITY)\n+\t\treturn false;\n+\n+\treturn pos >= i_size_read(iter->inode);\n }\n \n /**\n@@ -1167,13 +1184,14 @@ static int iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i,\n \t\t * unlock and release the folio.\n \t\t */\n \t\told_size = iter->inode->i_size;\n-\t\tif (pos + written > old_size) {\n+\t\tif (pos + written > old_size &&\n+\t\t    !(iter->iomap.flags & IOMAP_F_FSVERITY)) {\n \t\t\ti_size_write(iter->inode, pos + written);\n \t\t\titer->iomap.flags |= IOMAP_F_SIZE_CHANGED;\n \t\t}\n \t\t__iomap_put_folio(iter, write_ops, written, folio);\n \n-\t\tif (old_size < pos)\n+\t\tif (old_size < pos && !(iter->iomap.flags & IOMAP_F_FSVERITY))\n \t\t\tpagecache_isize_extended(iter->inode, old_size, pos);\n \n \t\tcond_resched();\n@@ -1801,13 +1819,20 @@ static int iomap_writeback_range(struct iomap_writepage_ctx *wpc,\n  * Check interaction of the folio with the file end.\n  *\n  * If the folio is entirely beyond i_size, return false.  If it straddles\n- * i_size, adjust end_pos and zero all data beyond i_size.\n+ * i_size, adjust end_pos and zero all data beyond i_size. Don't skip fsverity\n+ * folios as those are beyond i_size.\n  */\n-static bool iomap_writeback_handle_eof(struct folio *folio, struct inode *inode,\n-\t\tu64 *end_pos)\n+static bool iomap_writeback_handle_eof(struct folio *folio,\n+\t\tstruct iomap_writepage_ctx *wpc, u64 *end_pos)\n {\n+\tstruct inode *inode = wpc->inode;\n \tu64 isize = i_size_read(inode);\n \n+\tif (wpc->iomap.flags & IOMAP_F_FSVERITY) {\n+\t\tWARN_ON_ONCE(folio_pos(folio) < isize);\n+\t\treturn true;\n+\t}\n+\n \tif (*end_pos > isize) {\n \t\tsize_t poff = offset_in_folio(folio, isize);\n \t\tpgoff_t end_index = isize >> PAGE_SHIFT;\n@@ -1873,7 +1898,7 @@ int iomap_writeback_folio(struct iomap_writepage_ctx *wpc, struct folio *folio)\n \n \ttrace_iomap_writeback_folio(inode, pos, folio_size(folio));\n \n-\tif (!iomap_writeback_handle_eof(folio, inode, &end_pos))\n+\tif (!iomap_writeback_handle_eof(folio, wpc, &end_pos))\n \t\treturn 0;\n \tWARN_ON_ONCE(end_pos <= pos);\n \ndiff --git a/fs/iomap/trace.h b/fs/iomap/trace.h\nindex 532787277b16..5252051cc137 100644\n--- a/fs/iomap/trace.h\n+++ b/fs/iomap/trace.h\n@@ -118,7 +118,8 @@ DEFINE_RANGE_EVENT(iomap_zero_iter);\n \t{ IOMAP_F_ATOMIC_BIO,\t\"ATOMIC_BIO\" }, \\\n \t{ IOMAP_F_PRIVATE,\t\"PRIVATE\" }, \\\n \t{ IOMAP_F_SIZE_CHANGED,\t\"SIZE_CHANGED\" }, \\\n-\t{ IOMAP_F_STALE,\t\"STALE\" }\n+\t{ IOMAP_F_STALE,\t\"STALE\" }, \\\n+\t{ IOMAP_F_FSVERITY,\t\"FSVERITY\" }\n \n \n #define IOMAP_DIO_STRINGS \\\ndiff --git a/include/linux/iomap.h b/include/linux/iomap.h\nindex 531f9ebdeeae..4506a99d5285 100644\n--- a/include/linux/iomap.h\n+++ b/include/linux/iomap.h\n@@ -87,6 +87,14 @@ struct vm_fault;\n #define IOMAP_F_INTEGRITY\t0\n #endif /* CONFIG_BLK_DEV_INTEGRITY */\n \n+/*\n+ * Indicates reads and writes of fsverity metadata.\n+ *\n+ * Fsverity metadata is stored after the regular file data and thus beyond\n+ * i_size.\n+ */\n+#define IOMAP_F_FSVERITY\t(1U << 10)\n+\n /*\n  * Flag reserved for file system specific usage\n  */\n","prefixes":["v7","07/22"]}