From patchwork Wed Oct 2 18:49:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13820260 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 599AECF319F for ; Wed, 2 Oct 2024 18:50:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7204B4401CA; Wed, 2 Oct 2024 14:50:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CEF34401B5; Wed, 2 Oct 2024 14:50:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F8B04401CA; Wed, 2 Oct 2024 14:50:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 24A084401B5 for ; Wed, 2 Oct 2024 14:50:21 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CCC95AC5DC for ; Wed, 2 Oct 2024 18:50:20 +0000 (UTC) X-FDA: 82629552600.22.E0CDACD Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id ECF8A20002 for ; Wed, 2 Oct 2024 18:50:18 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Jm6HRedi; spf=pass (imf03.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727894891; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=u6S2Fv2aERaJvv72TmoiJHl2rfCDCXnKds3UfJ3phqs=; b=1QiIvMExPkkQb/PLJZEi40NUOrCKCAmbDxVO67RyAZI4CeWNt7iZHzjJgqIaLfmQn14olF FDwoGGd0W7S148ia0M9wyVVqwSpXxzRCOKERzRlDwgva9I5zcPUT7oVc/kSrYJGxQ77qr8 0SAd25wmk1+o7geNO86ESl0KTDjwI0g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727894891; a=rsa-sha256; cv=none; b=2rocgTVGjwHRMuRu8Sfq5RLQDuvY+9PHaR7aNfRMhcqHTzQJ6R8qVfeemjd1nPaRt/lp9d pIEMqwhAR0kPwIrWBd3ldRLp76GimniPM+SC+e6wrthTeH7+Cl92X+hLwmXZ6l5kt5B/Nt Dn2jnAJT2XVSNDDrtsKFjMNXRWjoUMc= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Jm6HRedi; spf=pass (imf03.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EBA115C431C; Wed, 2 Oct 2024 18:50:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D106FC4CEC2; Wed, 2 Oct 2024 18:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727895017; bh=5lfqUj45QnwrVOVDCUQ2LnUQUpaLf2LkOjJrAuHMoZ8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Jm6HRedi2Q60O4WQojXVg3EB5FKC6fOcQmmc4GVn15b3YoEq4PV32Ke+gosH12scW ZA/OJDgT+bGZqSFB8tYv1Nu95tP9tX/WsSDsJbQHCL3AyogLZEh0zLrma9PWJ1nIrT NSY2QlJUNRav/+H+Yw7d2rFEPSugIhsR45BUNMWKpWHyPNq27+y59g4q9yAdjOmXqV nbJgviE1+jI7KcfVv5Cycj/JmtM2r9ahjOMRT2Bywld/m59TqSyX83HiadtrvAjTqk 3/uhTK/fqS0vs2ic3LAtWV7Ko7NgqqmzTB1TLgaSqJZQtVYXMpj89vOBkPP9SAAv9B c8MpznLyLLWdw== From: Jeff Layton Date: Wed, 02 Oct 2024 14:49:37 -0400 Subject: [PATCH v9 09/12] xfs: switch to multigrain timestamps MIME-Version: 1.0 Message-Id: <20241002-mgtime-v9-9-77e2baad57ac@kernel.org> References: <20241002-mgtime-v9-0-77e2baad57ac@kernel.org> In-Reply-To: <20241002-mgtime-v9-0-77e2baad57ac@kernel.org> To: John Stultz , Thomas Gleixner , Stephen Boyd , Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Jonathan Corbet , Randy Dunlap , Chandan Babu R , "Darrick J. Wong" , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Chuck Lever , Vadim Fedorenko Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, Jeff Layton X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3012; i=jlayton@kernel.org; h=from:subject:message-id; bh=5lfqUj45QnwrVOVDCUQ2LnUQUpaLf2LkOjJrAuHMoZ8=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBm/ZXNFfizrIh/qPxAkXi3xFswOUBA7q6HVl//Z Nf0eicKVQaJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZv2VzQAKCRAADmhBGVaC FcWND/97d+O8sPWKiT3s4JXUlD36zTj4bC7iSHTr7j5GsNtEzs9iTbJWkglnCEmxZn0WgdU2etT qLFxnGJKGOYK0BrOmozKkvSjXv13cifuCouB7vaZLA5/A74OODCGwYqYmz8YYs5OtKPdYs23wqA dZkGEObXPWuK+drG8PgNLQa13hlXjJ1oBZAzRTv6bmU6PcC9cBEYJoVyCBaopcQPJw2pJAg73kL LuVLq/U14v14gWmxW6+NSwCpOVlGr15nQnGhqaAC3SkFTL5z/+Fh7N4VJeVD0IBRoQyyEwJJwe4 edg7P0IoKfQJyaqUugCZ9u2f8YDAa/MZJKhjzoWGyv+QF/iyQtrn8ZHPnY5UyZ8ujoHZlFt40d0 2VhpIHgeNYS4QKAqTHP254a4VeWnI1n6xzQi5pozOsPZEo0b20E6vpjsngvI5K/p6rgwcF3ZkAc W5JUGqSt/j2RHkECa6m69Imp2VoCJ4xR30/iFPJbo0gPaR7gG7PERkBYsgUJfws1QbPqf2aK91a l+NTBUglrCXw3hanZ70+Z2xPr6xn2djNAsDy7UG5/LnzOr7QOJEL/Zd8NUKLJuDOV4tZGw/fOPX O2ogtnjx7MlR0WP3SAUn8Dhr1qLqO7nLO6zypRI/QJra+c7f4hB9XH9j1JTHVkMTxb4KQYkTvL2 eb4Hq1xvi9JVh6A== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: ECF8A20002 X-Stat-Signature: 8guxzju4pwf4zny16rhqxytfxrjo17n3 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1727895018-458139 X-HE-Meta: U2FsdGVkX1+Pz7Z4G75sinCgzfyESpjd89n+p9uv/rxkx8zyU3rd9rmx9N7SzM5A76zyRvQs+zq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YpSK/cAzGNbC7j/k7+60ciK7650vXOtZEnDHPbK9Oh5AgDWfSSGp5fed3+O5rLepCS5p//NByWiIg4RM6swZUbmv1FytOvIF/AQSQtXM48l2w+KRgZwtLEhqEHOqT8fKzxS35M16gH9VX/HGm59fVLXpFTxYQzLDp+cuMMn9jKmUqu3dFYtdI94hLWnknGSVHcq9y58CV2ATMKsCNeGhrajYOx/tSqilBQuFCOAfSjEdpi9ONRIC5PZn4ksAwtHeCwz09PbIl7JgZbKjHyBnFQhFyjuEvIOyHAyc/MtxwyNpwJiQQprM3q1wes/2/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Enable multigrain timestamps, which should ensure that there is an apparent change to the timestamp whenever it has been written after being actively observed via getattr. Also, anytime the mtime changes, the ctime must also change, and those are now the only two options for xfs_trans_ichgtime. Have that function unconditionally bump the ctime, and ASSERT that XFS_ICHGTIME_CHG is always set. Finally, stop setting STATX_CHANGE_COOKIE in getattr, since the ctime should give us better semantics now. Reviewed-by: Josef Bacik Reviewed-by: Darrick J. Wong Tested-by: Randy Dunlap # documentation bits Signed-off-by: Jeff Layton --- fs/xfs/libxfs/xfs_trans_inode.c | 6 +++--- fs/xfs/xfs_iops.c | 10 +++------- fs/xfs/xfs_super.c | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c index 3c40f37e82c7..c962ad64b0c1 100644 --- a/fs/xfs/libxfs/xfs_trans_inode.c +++ b/fs/xfs/libxfs/xfs_trans_inode.c @@ -62,12 +62,12 @@ xfs_trans_ichgtime( ASSERT(tp); xfs_assert_ilocked(ip, XFS_ILOCK_EXCL); - tv = current_time(inode); + /* If the mtime changes, then ctime must also change */ + ASSERT(flags & XFS_ICHGTIME_CHG); + tv = inode_set_ctime_current(inode); if (flags & XFS_ICHGTIME_MOD) inode_set_mtime_to_ts(inode, tv); - if (flags & XFS_ICHGTIME_CHG) - inode_set_ctime_to_ts(inode, tv); if (flags & XFS_ICHGTIME_ACCESS) inode_set_atime_to_ts(inode, tv); if (flags & XFS_ICHGTIME_CREATE) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 1cdc8034f54d..a1c4a350a6db 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -597,8 +597,9 @@ xfs_vn_getattr( stat->gid = vfsgid_into_kgid(vfsgid); stat->ino = ip->i_ino; stat->atime = inode_get_atime(inode); - stat->mtime = inode_get_mtime(inode); - stat->ctime = inode_get_ctime(inode); + + fill_mg_cmtime(stat, request_mask, inode); + stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks); if (xfs_has_v3inodes(mp)) { @@ -608,11 +609,6 @@ xfs_vn_getattr( } } - if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) { - stat->change_cookie = inode_query_iversion(inode); - stat->result_mask |= STATX_CHANGE_COOKIE; - } - /* * Note: If you add another clause to set an attribute flag, please * update attributes_mask below. diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 27e9f749c4c7..210481b03fdb 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -2052,7 +2052,7 @@ static struct file_system_type xfs_fs_type = { .init_fs_context = xfs_init_fs_context, .parameters = xfs_fs_parameters, .kill_sb = xfs_kill_sb, - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME, }; MODULE_ALIAS_FS("xfs");