Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2218289/?format=api
{ "id": 2218289, "url": "http://patchwork.ozlabs.org/api/patches/2218289/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260331212827.2631020-17-aalbersh@kernel.org/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/projects/8/?format=api", "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": "<20260331212827.2631020-17-aalbersh@kernel.org>", "list_archive_url": null, "date": "2026-03-31T21:28:17", "name": "[v6,16/22] xfs: remove unwritten extents after preallocations in fsverity metadata", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "00a99ad4d1170a19858a877d97aefe12aaa2774d", "submitter": { "id": 92821, "url": "http://patchwork.ozlabs.org/api/people/92821/?format=api", "name": "Andrey Albershteyn", "email": "aalbersh@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260331212827.2631020-17-aalbersh@kernel.org/mbox/", "series": [ { "id": 498255, "url": "http://patchwork.ozlabs.org/api/series/498255/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=498255", "date": "2026-03-31T21:28:01", "name": "fs-verity support for XFS with post EOF merkle tree", "version": 6, "mbox": "http://patchwork.ozlabs.org/series/498255/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2218289/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2218289/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=4cuo=B7=vger.kernel.org=linux-ext4+bounces-15563-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=ZDpzJfJj;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=150.107.74.76; helo=mail.ozlabs.org;\n envelope-from=srs0=4cuo=b7=vger.kernel.org=linux-ext4+bounces-15563-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c09:e001:a7::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=ZDpzJfJj;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15563-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=\"ZDpzJfJj\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76])\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 4flhDf5Gmqz1yFv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 08:33:06 +1100 (AEDT)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4flhDf4pmcz4wDJ\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 08:33:06 +1100 (AEDT)", "by gandalf.ozlabs.org (Postfix)\n\tid 4flhDf4lmdz4wGT; Wed, 01 Apr 2026 08:33:06 +1100 (AEDT)", "from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::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 4flhDb0ycvz4wDJ\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 01 Apr 2026 08:33:03 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 08456303FEBB\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 31 Mar 2026 21:31:03 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 7B062477980;\n\tTue, 31 Mar 2026 21:29:23 +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 3BE164657C6;\n\tTue, 31 Mar 2026 21:29:23 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id A58F8C19423;\n\tTue, 31 Mar 2026 21:29:20 +0000 (UTC)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1774992786; cv=pass;\n\tb=KQLrnZv+Bjt97h3+j8xYfRwkljarf2GkA5BLVAn8iDh/PkEq2xY1qWz/QejmEQU/r0KNxyL60M4IuHYLcwTTo7Ujopccb2M5AxFIT8v397qGPBI0fQmmaUKD02hwOa87kMhMonROFVn8IPe25xK6N7A64onFyY5E5CqYZqPxS5U/syURHzL3eioW+iEd1CEqZMO59+dtfosp/DrfXB8zk+Qz6vrByLOUQGIWXInb1vo911Yg0fSulWj0BpgW8xBNnFqWIgXn0bOK1CABjhHLFSR8ftth1BkzTDPN+hK26LEXaGexCHjJtJN0Xi6ImNh/f/4/bbnXio/7uJCSNbImXw==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774992563; cv=none;\n b=Ji1i5LJiAta7RloRmDWLJUzAVuexSDR9gslqeFs1liE63Jtm07rBuTuM6EG3v5YYbHkm3L3V7j1NSlQGskXmQzjic5n5UrTv6fVryGljB/4pYYJABVQg/xMepEZAdSTnkKaaQG+s7AfGyFXY4eE8OwDRDJJGQwYXwFrabGYZ5o0=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1774992786; c=relaxed/relaxed;\n\tbh=6/zmzAwIjMl/Fnz1FPbsiMuz9q1YHlUZQcYgfS6PpbE=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=lBisuU4onb3FG7lMHJKA9OT12bX3HN4/LzsYQV7bQPiCHPUNlMmTny/Q4T93viIpULXJzmF2y7ySZ2TVTpr0nEU55v5pV2YHwneiXg2DTQGztCMYuTaRI3cogsLNTaFuIEDP+EiKJPF1UX80RhUcx2FrAxHoDaRbDKcrjUUW1OHYipNPlPnJvalkeg4eM8aKrwfPnChhjT1zkemkSeVMNXLEDD3bT8Fiy8r/UDli4dhrBiOuoSS4KXb8OFO1SG+u7N0Qi/34pRdUbNCvLXMP2ADVO0SjlV2ccQVKbuBSFSVyZc/u6JTxpCoxGu7SHqbtFqOmlLX2MXnFOAm+ejIrYw==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774992563; c=relaxed/simple;\n\tbh=iOgFntkagcHnJzdVdNQ9ZYUIxxE/XWG3vo8zPAmv77U=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=LeVpVOfV/WPmtUrcENl7aMbHNZPp3v1TwU3SpmQ/lbnUbdVhj3X7/pxSMR51kcpZppPB0xPulyWcmaKI11C2DNR6+pbDTrTiGWY9QIBaBbQFX+XJYE5Xika9InJcMKZhQZ+LVBPVhM2ReARDeMYUM5+tsWpkWrlydKF1Wwl9R7U=" ], "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=ZDpzJfJj; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15563-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=ZDpzJfJj; 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=1774992563;\n\tbh=iOgFntkagcHnJzdVdNQ9ZYUIxxE/XWG3vo8zPAmv77U=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZDpzJfJj5OwM7uL6NistKiIgD+erSMLlCyY0qsotS7Q4rvj48xZ3c0JDt0+yL56N8\n\t T0s9cF5A7Pfjg+hZXguUXhhu1UFSoUQZkqwjr/YnQNCTeavmQVOh7pt2bio01MM3qr\n\t CisQck7Ss3qNKevQFR66K4NFhy+mvPkfB/OT+1PV+Jt293pgoS/b5TG7TYljhj6DS2\n\t 4vJwBBLJ8UYZEtfIW8OIWUEJqYkKSvdX7FQM1F3WCOWA/cB/gREilPIYIKK4Th46kX\n\t grFPUkdopeYDnPgoSovC1o8LxyagBYIKq1vKn8hVZKjmz8SGZVxJnEB/SJ/IGt55gu\n\t EjfQ3v2DoZAAQ==", "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 v6 16/22] xfs: remove unwritten extents after preallocations\n in fsverity metadata", "Date": "Tue, 31 Mar 2026 23:28:17 +0200", "Message-ID": "<20260331212827.2631020-17-aalbersh@kernel.org>", "X-Mailer": "git-send-email 2.51.2", "In-Reply-To": "<20260331212827.2631020-1-aalbersh@kernel.org>", "References": "<20260331212827.2631020-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": "XFS preallocates spaces during writes. In normal I/O this space, if\nunused, is removed by truncate. For files with fsverity XFS does not use\ntruncate as fsverity metadata is stored past EOF.\n\nAfter we're done with writing fsverity metadata iterate over extents in\nthat region and remove any unwritten ones. These would be left overs in\nthe holes in the merkle tree and past fsverity descriptor.\n\nReviewed-by: Christoph Hellwig <hch@lst.de>\nSigned-off-by: Andrey Albershteyn <aalbersh@kernel.org>\n---\n fs/xfs/xfs_fsverity.c | 67 +++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 67 insertions(+)", "diff": "diff --git a/fs/xfs/xfs_fsverity.c b/fs/xfs/xfs_fsverity.c\nindex 5a6a48fcf843..b193009a1bdb 100644\n--- a/fs/xfs/xfs_fsverity.c\n+++ b/fs/xfs/xfs_fsverity.c\n@@ -21,6 +21,8 @@\n #include \"xfs_iomap.h\"\n #include \"xfs_error.h\"\n #include \"xfs_health.h\"\n+#include \"xfs_bmap.h\"\n+#include \"xfs_bmap_util.h\"\n #include <linux/fsverity.h>\n #include <linux/iomap.h>\n #include <linux/pagemap.h>\n@@ -173,6 +175,63 @@ xfs_fsverity_delete_metadata(\n \treturn error;\n }\n \n+static int\n+xfs_fsverity_cancel_unwritten(\n+\tstruct xfs_inode\t*ip,\n+\txfs_fileoff_t\t\tstart,\n+\txfs_fileoff_t\t\tend)\n+{\n+\tstruct xfs_mount\t*mp = ip->i_mount;\n+\tstruct xfs_trans\t*tp;\n+\txfs_fileoff_t\t\toffset_fsb = XFS_B_TO_FSB(mp, start);\n+\txfs_fileoff_t\t\tend_fsb = XFS_B_TO_FSB(mp, end);\n+\tstruct xfs_bmbt_irec\timap;\n+\tint\t\t\tnimaps;\n+\tint\t\t\terror = 0;\n+\tint\t\t\tdone;\n+\n+\n+\twhile (offset_fsb < end_fsb) {\n+\t\tnimaps = 1;\n+\n+\t\terror = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, 0, 0,\n+\t\t\t\t0, &tp);\n+\t\tif (error)\n+\t\t\treturn error;\n+\n+\t\txfs_ilock(ip, XFS_ILOCK_EXCL);\n+\t\terror = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb,\n+\t\t\t\t&imap, &nimaps, 0);\n+\t\tif (error)\n+\t\t\tgoto out_cancel;\n+\n+\t\tif (nimaps == 0)\n+\t\t\tgoto out_cancel;\n+\n+\t\tif (imap.br_state == XFS_EXT_UNWRITTEN) {\n+\t\t\txfs_trans_ijoin(tp, ip, 0);\n+\n+\t\t\terror = xfs_bunmapi(tp, ip, imap.br_startoff,\n+\t\t\t\t\timap.br_blockcount, 0, 1, &done);\n+\t\t\tif (error)\n+\t\t\t\tgoto out_cancel;\n+\n+\t\t\terror = xfs_trans_commit(tp);\n+\t\t} else {\n+\t\t\txfs_trans_cancel(tp);\n+\t\t}\n+\t\txfs_iunlock(ip, XFS_ILOCK_EXCL);\n+\n+\t\toffset_fsb = imap.br_startoff + imap.br_blockcount;\n+\t}\n+\n+\treturn error;\n+out_cancel:\n+\txfs_trans_cancel(tp);\n+\txfs_iunlock(ip, XFS_ILOCK_EXCL);\n+\treturn error;\n+}\n+\n \n /*\n * Prepare to enable fsverity by clearing old metadata.\n@@ -248,6 +307,14 @@ xfs_fsverity_end_enable(\n \tif (error)\n \t\tgoto out;\n \n+\t/*\n+\t * Remove unwritten extents left by COW preallocations and write\n+\t * preallocation in the merkle tree holes and past descriptor\n+\t */\n+\terror = xfs_fsverity_cancel_unwritten(ip, range_start, LLONG_MAX);\n+\tif (error)\n+\t\tgoto out;\n+\n \t/*\n \t * Proactively drop any delayed allocations in COW fork, the fsverity\n \t * files are read-only\n", "prefixes": [ "v6", "16/22" ] }