Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2220009/?format=api
{ "id": 2220009, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2220009/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260405195007.1306-3-DefendTheDisabled@gmail.com/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260405195007.1306-3-DefendTheDisabled@gmail.com>", "list_archive_url": null, "date": "2026-04-05T19:49:58", "name": "[2/6] btrfs: add provenance time (ptime) support", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "44f4ad28992dcfdbfab3cc4a56c483c8cecd0374", "submitter": { "id": 93064, "url": "http://patchwork.ozlabs.org/api/1.2/people/93064/?format=api", "name": "Sean Smith", "email": "defendthedisabled@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260405195007.1306-3-DefendTheDisabled@gmail.com/mbox/", "series": [ { "id": 498804, "url": "http://patchwork.ozlabs.org/api/1.2/series/498804/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=498804", "date": "2026-04-05T19:49:56", "name": "provenance_time (ptime): a new settable timestamp for cross-filesystem provenance", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498804/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2220009/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2220009/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=Dd86=CE=vger.kernel.org=linux-ext4+bounces-15644-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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=P0d1Y2kO;\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=dd86=ce=vger.kernel.org=linux-ext4+bounces-15644-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=none dis=none) header.from=gmail.com", "gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=P0d1Y2kO;\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-15644-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"P0d1Y2kO\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.160.54", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com" ], "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 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fpjkV22zYz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 06 Apr 2026 05:50:58 +1000 (AEST)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fpjkV1myvz4wCm\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 06 Apr 2026 05:50:58 +1000 (AEST)", "by gandalf.ozlabs.org (Postfix)\n\tid 4fpjkV1hxvz4wF0; Mon, 06 Apr 2026 05:50:58 +1000 (AEST)", "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 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4fpjkQ3kNJz4wCm\n\tfor <patchwork-incoming@ozlabs.org>; Mon, 06 Apr 2026 05:50:54 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id D4CFB3001FF6\n\tfor <patchwork-incoming@ozlabs.org>; Sun, 5 Apr 2026 19:50:41 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 6F29D382290;\n\tSun, 5 Apr 2026 19:50:36 +0000 (UTC)", "from mail-oa1-f54.google.com (mail-oa1-f54.google.com\n [209.85.160.54])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id A1DC6381AEA\n\tfor <linux-ext4@vger.kernel.org>; Sun, 5 Apr 2026 19:50:34 +0000 (UTC)", "by mail-oa1-f54.google.com with SMTP id\n 586e51a60fabf-40423dbe98bso1253251fac.2\n for <linux-ext4@vger.kernel.org>;\n Sun, 05 Apr 2026 12:50:34 -0700 (PDT)", "from localhost.localdomain (c-73-5-99-191.hsd1.la.comcast.net.\n [73.5.99.191])\n by smtp.gmail.com with ESMTPSA id\n 5614622812f47-46f46160155sm4547428b6e.17.2026.04.05.12.50.32\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 05 Apr 2026 12:50:32 -0700 (PDT)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775418658; cv=pass;\n\tb=wI2okmW7Nk8G/v2SWazlDHu8mzmqKVUIKKjfdLYTsG7HhZMTD9jReh6Zm49geQ9U9lvGBhY2vHOAca6IikuDmVAhNq6rtG07kYuPXgmJ6JTb5g1TSCZ6/zHPlzje6d78/zNcZGCWjoRPTkSRJfwpGClDbP1K3ogRPeMP53MkHofwrbOdtpTLaeuOrPToI8mTYv9KvN4I9m1bXcio9sIc9GH87e6015yq6DmV9e4WRPvgli+S0vnbfmu28nxpjqxFpL/1HSNc2W8v0mOMtlBLhYmn77K0QH+GrNYGoJRVie8ngwevZA/zrktZpg+Jq1YhLwAgSWEOyj6FYtr53AsD0A==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775418636; cv=none;\n b=qHmIf/aMeE0OJ7gAngelPdUU6qnZGOUNDsJQmbf9lPzHRjZRGuhwNZl9zXZC5Bu0/0+UfRV3eF7UW0Ruh/0qorR38HyWnBCzfxXHlQDeS4vzPI7t+fD1wyE9gRCX0Zoe+PMk3H3R3Se0FpptaWSwVHX7Zzomfk+oq+XjJ83Mnf0=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775418658; c=relaxed/relaxed;\n\tbh=0UrIwJqOEWN8CqB58IAv7ymZXeOXfq1k3iasJiHQ/4Y=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=k3VKPgqdAw70k9Jhxno64gLi1wBKRbm/yQZ3DMLtBmYTUVm0gQs9NsYXwXXhmfqhCwfOZHk7f/A9KTnhIv2OwEQGroNqJuMFPjnKGNAZ6/sSk0Sw+2ag40s0tQ0GlNIgJdX02F7LQUK6joPUXrm71h1JVUHT72mbeQtc6tgMS8D+6PNqFbUBWspd2SD4yB+t5Utx54IfsLTN4E6hiRsEKBbKus2hVT9PGiJfae5wqPshteuPYVfvcNDrtF/NDhWlMLEMmC/fHDCv9jL3cdo40VitUegVDLnh+DexdBzJzrZ/VTN9HJJvxWxX+ir4q8qaraZwrjm79cK9ss52vs1AyQ==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775418636; c=relaxed/simple;\n\tbh=86iU4DdMA36g4XN2jsK7LFKschNuqEBgNYcZ9RMG0CE=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=PFMjOA0583BL1DmRsybQMvVv0NIUU2RYItPBvEUbV5qasn8gI52Q0Jx495AlZbXcxVeQfxure+jAnx1VNz1vql0sJ8Ju3GOXtq5ezeXjQT+elWUrOzNzQY4MyW4sJec6/eBQMPGg4t3iVJo2BfOYpGIUjT7AsqwyKkhFpd/SXTs=" ], "ARC-Authentication-Results": [ "i=2; gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com; dkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=P0d1Y2kO; 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-15644-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=P0d1Y2kO; arc=none smtp.client-ip=209.85.160.54" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775418633; x=1776023433;\n darn=vger.kernel.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=0UrIwJqOEWN8CqB58IAv7ymZXeOXfq1k3iasJiHQ/4Y=;\n b=P0d1Y2kOPGY0K2ZXixgTgOIpcsSp8knDSFySoiS9GQX+ePrHlaqU8CyxXsPoPTx2rG\n 8dOU2IwEgHerGcaPrmbKNGFsIrQG9KWSFsxalAM6P5L5zd0Qb70rQkDPDZEYlrhkAay8\n rb6ADp7h90opFEQIrbx2HNJGvhRnOmZ/jxs8TsGsGhYqc7SCqykHKB8trD7pJXQNJTiX\n oNGX5y3ZvBlkVt3PMoB1C8iddPe0sCo13fM+DhH+QL5gMonM0u8sgmpmPBGUHq9TPfbH\n Ivv1ZpjDDekkMomU54vRJN4IE/cZ7pWg0tPjpR5AEF6fw7qyyq/pYZTBiOkbmV9q0QQ8\n QUXQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775418633; x=1776023433;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=0UrIwJqOEWN8CqB58IAv7ymZXeOXfq1k3iasJiHQ/4Y=;\n b=rxiB9VnX0ZRxeplZdjdW0b7tLvlL2LrbM9JWYvhiz1BqXHZtVAHhMIshqoMgyloWhb\n Fvbn8Zn+wGRL7XPNtKeQxe1et45nmqZBdt/6z+dN5vFYPO4x9Y/JiBoCK1GrOeWp5xFR\n 7Vaj1LohQitDzkONm8voncJv9mr4Gn2nzMGgoFSwqojexiQUdNe4itAYuXs39KyoK04p\n UPlC0weLMDdTtkjEVfdMi4WsP/UMr9n3OWD4kpmqLhFZUGsGf23gvxZmpJipEgX5zlMY\n TXtkPqRUq+lAKSKqxKVKLo6r63Hx1GJ/liWIZSjpa8xay6gmIC2/sjfigbFoAAXImNWf\n 41Vw==", "X-Gm-Message-State": "AOJu0YxFVn40j/6oTsqMKSIUO65j8AHeEAaZs3X2UngtEaIGDoCXCnlX\n\thMBGKI3xfdTpzdBzFGzRImhu5+Ba8TPm9PuFfMyTZ5AH1KjEPTA1Np5B", "X-Gm-Gg": "AeBDieuJVchl3sybnSH9sAtcN+vdog5jNtU28c98H6rhxN5hRXlDcj/bN+hMbXhUUwZ\n\tWmiQyk1zCB+r7t9gWpykkFTulLiLxRoOu33Ag3ElbctwLVqY0aMOVHl5Pue2R4orVioqiikLdo/\n\tSMG/ScvbVPNuDZHtXhwpthTJmx2/ehgmckjOiSNtDzg24118IE1GaW4Uy5SKLlXpHGkSbawtHxF\n\tdwWvilet+xYxODL+WuvqqSCUc6o3MaMz/WkTePE1RTcbMUz7kbptPNsI2Ij2Ndl1qyj+pDPzvXn\n\tIZOQXbNtkiIAs31L3Bs9Ok5I+ES84pwDE+LcIyAS1r3kQ9dDyIRy+2n6HffNijCbnTMwjito4Yd\n\tZHFxaiuG2hg4JVHc2i/mB8cz2mEWBDIqEPHNCRc/H7PzASk/mOAzETWKr64pD29NanG4W/N35Lm\n\t9whurw3/dX8MQMmKo0nyin/9a/S7A1QwRBWsHFLsdeGnxzIwkdF9sBNIsnnMHRY6hOTxlGHWRH7\n\tOvEP8qxqHDa//I=", "X-Received": "by 2002:a05:6808:1b23:b0:467:2a6e:adad with SMTP id\n 5614622812f47-46ef4f05067mr4952557b6e.11.1775418633206;\n Sun, 05 Apr 2026 12:50:33 -0700 (PDT)", "From": "Sean Smith <defendthedisabled@gmail.com>", "X-Google-Original-From": "Sean Smith <DefendTheDisabled@gmail.com>", "To": "linux-fsdevel@vger.kernel.org", "Cc": "linux-ext4@vger.kernel.org,\n\tlinux-btrfs@vger.kernel.org,\n\ttytso@mit.edu,\n\tdsterba@suse.com,\n\tdavid@fromorbit.com,\n\tbrauner@kernel.org,\n\tosandov@osandov.com,\n\talmaz@kernel.org,\n\thirofumi@mail.parknet.co.jp,\n\tlinkinjeon@kernel.org,\n\tSean Smith <DefendTheDisabled@gmail.com>", "Subject": "[PATCH 2/6] btrfs: add provenance time (ptime) support", "Date": "Sun, 5 Apr 2026 14:49:58 -0500", "Message-ID": "<20260405195007.1306-3-DefendTheDisabled@gmail.com>", "X-Mailer": "git-send-email 2.51.0.windows.1", "In-Reply-To": "<20260405195007.1306-1-DefendTheDisabled@gmail.com>", "References": "<20260405195007.1306-1-DefendTheDisabled@gmail.com>", "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-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-Spam-Status": "No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tFREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,\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": "Store ptime as a dedicated field in btrfs_inode_item reserved space:\nstruct btrfs_timespec (12 bytes) + __le32 pad (4 bytes) = 16 bytes,\nconsuming 2 of 4 reserved __le64 slots, leaving 2 free.\n\nIn-memory: i_ptime_sec/i_ptime_nsec in struct btrfs_inode.\nPersistence: delayed-inode read/write path (the primary persistence\npath for normal inodes, not fill_inode_item).\nTree-log: ptime written to log tree for fsync crash recovery.\nNew inode: initialized to zero (ptime unset).\n\nGetattr reports ptime only when non-zero (distinguishes unset from\nsupported-but-zero). Setattr accepts ATTR_PTIME and sets\nBTRFS_FEATURE_COMPAT_RO_PTIME - old kernels see unknown compat_ro\nbit and refuse RW mount, protecting ptime data.\n\nRename-over preservation: when rename(source, target) replaces an\nexisting regular file, if source has ptime=0 and target has ptime\nset, inherit target ptime to source. Guards: S_ISREG both sides,\nnlink==1, not RENAME_EXCHANGE/WHITEOUT. Atomic with rename\ntransaction. Enables atomic-save survival (write-temp + rename).\n\nSigned-off-by: Sean Smith <DefendTheDisabled@gmail.com>\n---\n fs/btrfs/btrfs_inode.h | 4 ++++\n fs/btrfs/delayed-inode.c | 4 ++++\n fs/btrfs/fs.h | 3 ++-\n fs/btrfs/inode.c | 42 +++++++++++++++++++++++++++++++++\n fs/btrfs/tree-log.c | 2 ++\n include/uapi/linux/btrfs.h | 1 +\n include/uapi/linux/btrfs_tree.h | 4 +++-\n 7 files changed, 58 insertions(+), 2 deletions(-)", "diff": "diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h\nindex 73602ee8d..bac92f766 100644\n--- a/fs/btrfs/btrfs_inode.h\n+++ b/fs/btrfs/btrfs_inode.h\n@@ -334,6 +334,10 @@ struct btrfs_inode {\n \tu64 i_otime_sec;\n \tu32 i_otime_nsec;\n \n+\t/* Provenance time - original creation date of file content. */\n+\tu64 i_ptime_sec;\n+\tu32 i_ptime_nsec;\n+\n \t/* Hook into fs_info->delayed_iputs */\n \tstruct list_head delayed_iput;\n \ndiff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c\nindex 7e3d294a6..649de7c29 100644\n--- a/fs/btrfs/delayed-inode.c\n+++ b/fs/btrfs/delayed-inode.c\n@@ -1887,6 +1887,8 @@ static void fill_stack_inode_item(struct btrfs_trans_handle *trans,\n \n \tbtrfs_set_stack_timespec_sec(&inode_item->otime, inode->i_otime_sec);\n \tbtrfs_set_stack_timespec_nsec(&inode_item->otime, inode->i_otime_nsec);\n+\tbtrfs_set_stack_timespec_sec(&inode_item->ptime, inode->i_ptime_sec);\n+\tbtrfs_set_stack_timespec_nsec(&inode_item->ptime, inode->i_ptime_nsec);\n }\n \n int btrfs_fill_inode(struct btrfs_inode *inode, u32 *rdev)\n@@ -1935,6 +1937,8 @@ int btrfs_fill_inode(struct btrfs_inode *inode, u32 *rdev)\n \n \tinode->i_otime_sec = btrfs_stack_timespec_sec(&inode_item->otime);\n \tinode->i_otime_nsec = btrfs_stack_timespec_nsec(&inode_item->otime);\n+\tinode->i_ptime_sec = btrfs_stack_timespec_sec(&inode_item->ptime);\n+\tinode->i_ptime_nsec = btrfs_stack_timespec_nsec(&inode_item->ptime);\n \n \tvfs_inode->i_generation = inode->generation;\n \tif (S_ISDIR(vfs_inode->i_mode))\ndiff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h\nindex 8ffbc40eb..7c8105ecf 100644\n--- a/fs/btrfs/fs.h\n+++ b/fs/btrfs/fs.h\n@@ -284,7 +284,8 @@ enum {\n \t(BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE |\t\\\n \t BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID | \\\n \t BTRFS_FEATURE_COMPAT_RO_VERITY |\t\t\\\n-\t BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE)\n+\t BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE | \\\n+\t BTRFS_FEATURE_COMPAT_RO_PTIME)\n \n #define BTRFS_FEATURE_COMPAT_RO_SAFE_SET\t0ULL\n #define BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR\t0ULL\ndiff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c\nindex 13f1f3b52..dce80561a 100644\n--- a/fs/btrfs/inode.c\n+++ b/fs/btrfs/inode.c\n@@ -4029,6 +4029,8 @@ static int btrfs_read_locked_inode(struct btrfs_inode *inode, struct btrfs_path\n \n \tinode->i_otime_sec = btrfs_timespec_sec(leaf, &inode_item->otime);\n \tinode->i_otime_nsec = btrfs_timespec_nsec(leaf, &inode_item->otime);\n+\tinode->i_ptime_sec = btrfs_timespec_sec(leaf, &inode_item->ptime);\n+\tinode->i_ptime_nsec = btrfs_timespec_nsec(leaf, &inode_item->ptime);\n \n \tinode_set_bytes(vfs_inode, btrfs_inode_nbytes(leaf, inode_item));\n \tinode->generation = btrfs_inode_generation(leaf, inode_item);\n@@ -4220,6 +4222,8 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,\n \n \tbtrfs_set_timespec_sec(leaf, &item->otime, BTRFS_I(inode)->i_otime_sec);\n \tbtrfs_set_timespec_nsec(leaf, &item->otime, BTRFS_I(inode)->i_otime_nsec);\n+\tbtrfs_set_timespec_sec(leaf, &item->ptime, BTRFS_I(inode)->i_ptime_sec);\n+\tbtrfs_set_timespec_nsec(leaf, &item->ptime, BTRFS_I(inode)->i_ptime_nsec);\n \n \tbtrfs_set_inode_nbytes(leaf, item, inode_get_bytes(inode));\n \tbtrfs_set_inode_generation(leaf, item, BTRFS_I(inode)->generation);\n@@ -5424,6 +5428,12 @@ static int btrfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,\n \t}\n \n \tif (attr->ia_valid) {\n+\t\tif (attr->ia_valid & ATTR_PTIME) {\n+\t\t\tBTRFS_I(inode)->i_ptime_sec = attr->ia_ptime.tv_sec;\n+\t\t\tBTRFS_I(inode)->i_ptime_nsec = attr->ia_ptime.tv_nsec;\n+\t\t\tbtrfs_set_fs_compat_ro(BTRFS_I(inode)->root->fs_info, PTIME);\n+\t\t}\n+\n \t\tsetattr_copy(idmap, inode, attr);\n \t\tinode_inc_iversion(inode);\n \t\tret = btrfs_dirty_inode(BTRFS_I(inode));\n@@ -8007,6 +8017,8 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)\n \n \tei->i_otime_sec = 0;\n \tei->i_otime_nsec = 0;\n+\tei->i_ptime_sec = 0;\n+\tei->i_ptime_nsec = 0;\n \n \tinode = &ei->vfs_inode;\n \tbtrfs_extent_map_tree_init(&ei->extent_tree);\n@@ -8159,6 +8171,14 @@ static int btrfs_getattr(struct mnt_idmap *idmap,\n \tu32 bi_ro_flags = BTRFS_I(inode)->ro_flags;\n \n \tstat->result_mask |= STATX_BTIME;\n+\tif (request_mask & STATX_PTIME) {\n+\t\tif (BTRFS_I(inode)->i_ptime_sec ||\n+\t\t BTRFS_I(inode)->i_ptime_nsec) {\n+\t\t\tstat->ptime.tv_sec = BTRFS_I(inode)->i_ptime_sec;\n+\t\t\tstat->ptime.tv_nsec = BTRFS_I(inode)->i_ptime_nsec;\n+\t\t\tstat->result_mask |= STATX_PTIME;\n+\t\t}\n+\t}\n \tstat->btime.tv_sec = BTRFS_I(inode)->i_otime_sec;\n \tstat->btime.tv_nsec = BTRFS_I(inode)->i_otime_nsec;\n \tif (bi_flags & BTRFS_INODE_APPEND)\n@@ -8675,6 +8695,28 @@ static int btrfs_rename(struct mnt_idmap *idmap,\n \t\t\tbtrfs_abort_transaction(trans, ret);\n \t\t\tgoto out_fail;\n \t\t}\n+\t\t/*\n+\t\t * ptime rename-over preservation: if a file with no ptime\n+\t\t * is being renamed over a file that has ptime (the atomic\n+\t\t * save pattern: write-to-temp + rename over original),\n+\t\t * inherit the target's ptime so provenance survives.\n+\t\t */\n+\t\tif (new_inode && S_ISREG(old_inode->i_mode) &&\n+\t\t S_ISREG(new_inode->i_mode) && old_inode->i_nlink == 1 &&\n+\t\t !(flags & (RENAME_EXCHANGE | RENAME_WHITEOUT))) {\n+\t\t\tstruct btrfs_inode *old_bi = BTRFS_I(old_inode);\n+\t\t\tstruct btrfs_inode *new_bi = BTRFS_I(new_inode);\n+\t\t\tif (!old_bi->i_ptime_sec && !old_bi->i_ptime_nsec &&\n+\t\t\t (new_bi->i_ptime_sec || new_bi->i_ptime_nsec)) {\n+\t\t\t\told_bi->i_ptime_sec = new_bi->i_ptime_sec;\n+\t\t\t\told_bi->i_ptime_nsec = new_bi->i_ptime_nsec;\n+\t\t\t}\n+\t\t}\n+\t\t/* Note: if rename fails below, ptime mutation is harmless —\n+\t\t * the source file keeps its previous ptime=0 semantics since\n+\t\t * the rename didn't complete. The in-memory value will be\n+\t\t * overwritten on next inode read from disk. */\n+\n \t\tret = btrfs_update_inode(trans, BTRFS_I(old_inode));\n \t\tif (unlikely(ret)) {\n \t\t\tbtrfs_abort_transaction(trans, ret);\ndiff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c\nindex 6c40f48cc..7ed09af22 100644\n--- a/fs/btrfs/tree-log.c\n+++ b/fs/btrfs/tree-log.c\n@@ -4640,6 +4640,8 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,\n \n \tbtrfs_set_timespec_sec(leaf, &item->otime, BTRFS_I(inode)->i_otime_sec);\n \tbtrfs_set_timespec_nsec(leaf, &item->otime, BTRFS_I(inode)->i_otime_nsec);\n+\tbtrfs_set_timespec_sec(leaf, &item->ptime, BTRFS_I(inode)->i_ptime_sec);\n+\tbtrfs_set_timespec_nsec(leaf, &item->ptime, BTRFS_I(inode)->i_ptime_nsec);\n \n \t/*\n \t * We do not need to set the nbytes field, in fact during a fast fsync\ndiff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h\nindex e8fd92789..d2c542425 100644\n--- a/include/uapi/linux/btrfs.h\n+++ b/include/uapi/linux/btrfs.h\n@@ -313,6 +313,7 @@ struct btrfs_ioctl_fs_info_args {\n * reducing mount time for large filesystem due to better locality.\n */\n #define BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE\t(1ULL << 3)\n+#define BTRFS_FEATURE_COMPAT_RO_PTIME\t\t\t(1ULL << 4)\n \n #define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF\t(1ULL << 0)\n #define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL\t(1ULL << 1)\ndiff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h\nindex fc29d2738..719c00363 100644\n--- a/include/uapi/linux/btrfs_tree.h\n+++ b/include/uapi/linux/btrfs_tree.h\n@@ -890,7 +890,9 @@ struct btrfs_inode_item {\n \t * a little future expansion, for more than this we can\n \t * just grow the inode item and version it\n \t */\n-\t__le64 reserved[4];\n+\tstruct btrfs_timespec ptime;\n+\t__le32 __reserved_pad;\n+\t__le64 reserved[2];\n \tstruct btrfs_timespec atime;\n \tstruct btrfs_timespec ctime;\n \tstruct btrfs_timespec mtime;\n", "prefixes": [ "2/6" ] }