{"id":2225129,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2225129/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260420114714.1621982-8-aalbersh@kernel.org/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.1/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},"msgid":"<20260420114714.1621982-8-aalbersh@kernel.org>","date":"2026-04-20T11:46:54","name":"[v8,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.1/people/92821/?format=json","name":"Andrey Albershteyn","email":"aalbersh@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260420114714.1621982-8-aalbersh@kernel.org/mbox/","series":[{"id":500600,"url":"http://patchwork.ozlabs.org/api/1.1/series/500600/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=500600","date":"2026-04-20T11:46:51","name":"fs-verity support for XFS with post EOF merkle tree","version":8,"mbox":"http://patchwork.ozlabs.org/series/500600/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2225129/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2225129/checks/","tags":{},"headers":{"Return-Path":"\n <SRS0=SJil=CT=vger.kernel.org=linux-ext4+bounces-15920-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=ALQ2AaZI;\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=sjil=ct=vger.kernel.org=linux-ext4+bounces-15920-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.234.253.10 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=ALQ2AaZI;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15920-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=\"ALQ2AaZI\"","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 4fzkPC5TFxz1yD4\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 21:52:15 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fzkPC530Vz4wCm\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 21:52:15 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4fzkPC50pJz4wCx; Mon, 20 Apr 2026 21:52:15 +1000 (AEST)","from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\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 4fzkP82r9Mz4wCm\n\tfor <patchwork-incoming@ozlabs.org>; Mon, 20 Apr 2026 21:52:12 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 2D111310C0F9\n\tfor <patchwork-incoming@ozlabs.org>; Mon, 20 Apr 2026 11:47:59 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id B1BB339E18C;\n\tMon, 20 Apr 2026 11:47:58 +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 701471ADFE4;\n\tMon, 20 Apr 2026 11:47:58 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 97BD6C19425;\n\tMon, 20 Apr 2026 11:47:53 +0000 (UTC)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1776685935; cv=pass;\n\tb=kYbkIu5n57cA93wR7Oda/9pkrcClHWF3IcndU83JvpI8WlUEMe+L2uninCGYL3TxZC76szNhVnfBk0AlvIQxC3W8tNmD5ra/2oMiR3kH+newahbv33EgfZrU/08AMmvJlu8XeBCuQsQTdXm3FIQ17mQAvv1bL0SxPDsY3yLqJfL2wDvJ6lgmmfFIia0DiP8+zNzp+iyl5X8iO72aLfkfkoqzvoTt3eWwb/PJhVQiuF28ps1YIaVdoO7qL2Jb4+kLRyn7v920+uXoJTOBfu2PUcIpZ3WyhFIE0oATWuv8g1fBqT9dLQOiObha3dLdcPnk6x7rkQGhravdb0OFSb1AsA==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776685678; cv=none;\n b=Drgdt70I2mOepmEU8WjGaA3MJ6k94aoHswl+pxdqSUpA0gJOj1WDGj5laNaAtex3L8FUOGG4jhFnvHRfeNgTkzIj6hl/+aVCkKNjfVL1qK1jHy3gGR8Umxjnjif0uWVaFm37YYi02qMbEz+LohCZD21+UVdleVtUpiYLRRBpao4="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1776685935; 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=DM3Rm2xgB+ezgpd7V7XF976n1FNGtL36M4PDmIcQpnUKlv5Ajhd6Pu5NbXBLHVAutuqvqIB23uh6YMvin6gZyy3vBfmb5MgFuPVmiL+9bJmcOiN/QCljJ3hxIbzwUyBFq30Mi1l6+ncjgWXZYg8E6p5cFsfiAbgpe/UWuznF/OuNJXsG9uWnJdH5XDligntFTYVLlGjMDj0qGM9YzUNmsaF4TF13aRYHF80Bl2YAoqHaYQScvaM1BFwoq94gaDhX5Ukh8nElEcPQ59NqKpIkjDFGcxN28D1O+aovN2iw5oWgJfZyf8fsLx69IKi7QG4kG1vdfOcSMCU3300/CuhMgQ==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776685678; 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=uTxmBBSgYRSjh4nO6g4LIqLgUTOvu5/PuuCzMY5CN04gRVy5LKtKnndgxZyudldZCiC4IolUi/x+gl7X2pDmCbdLs28wtvoo6XRrzXfhFGnxHpBz5N7s+fj90qwZT+jlAHSAAkuEGj2rR7N+JsyX6soT8ysONSr7V0uM+CMQ4D8="],"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=ALQ2AaZI; dkim-atps=neutral;\n spf=pass (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15920-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=ALQ2AaZI; 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=1776685676;\n\tbh=Eaaq0hH8g1nljZhSJeNsb1Z/i9y2O7ArKbTh9ZdwoXg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ALQ2AaZI7saZkzWBK7wkhlgvNod+CZ6TBQKdfXTrqzBEWeT8L7JPW+Vm7UjQZE1mO\n\t mAhCww80KSMEq7xTAsyNH5Npja2ztnMU11wN3dYAIwYymEnwKloi1AQWZ7qDEez/zk\n\t vlkRMjnzIwxW+FZ+aHwFvbIFnRNOlcaW0Il/W/x4QnV021nAD7kbSr4VoEdx8zGAlY\n\t ueWvlhgXOTfuUeGXaHGRpLvvF3baTs86EElPkE0qRzYu+1DHcGVhZKRPdEMfp8rvVD\n\t 6tToExtathaiV3d5C9A5uWu6VPuAj4YBlVtf2kFymv7jbPj2nJqtdvU3T3X539BpZn\n\t iANuyCKX4ufog==","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\tlinux-unionfs@vger.kernel.org,\n\tdjwong@kernel.org","Subject":"[PATCH v8 07/22] iomap: introduce IOMAP_F_FSVERITY and teach\n writeback to handle fsverity","Date":"Mon, 20 Apr 2026 13:46:54 +0200","Message-ID":"<20260420114714.1621982-8-aalbersh@kernel.org>","X-Mailer":"git-send-email 2.51.2","In-Reply-To":"<20260420114714.1621982-1-aalbersh@kernel.org>","References":"<20260420114714.1621982-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":["v8","07/22"]}