From patchwork Wed Oct 2 21:27:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13820401 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 34CB5CF8542 for ; Wed, 2 Oct 2024 21:28:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E71EB6B0474; Wed, 2 Oct 2024 17:27:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DCF346B0478; Wed, 2 Oct 2024 17:27:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C26046B0477; Wed, 2 Oct 2024 17:27:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 93C436B0474 for ; Wed, 2 Oct 2024 17:27:59 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3C2E31C6CD9 for ; Wed, 2 Oct 2024 21:27:59 +0000 (UTC) X-FDA: 82629949878.02.864B05A Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf24.hostedemail.com (Postfix) with ESMTP id 729C518000A for ; Wed, 2 Oct 2024 21:27:57 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uXWl4i2t; spf=pass (imf24.hostedemail.com: domain of jlayton@kernel.org designates 147.75.193.91 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=1727904348; 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=bcSIvLQqq3cBjG0xacxKgM+4NgKUngeWHZItOh0ii1I=; b=FEQhpWr6PxPDyp7IxEG1sBWKaxd4GCFcLME7ahHzoTM/RBG45r0unFsRxcLWdvrC0p3XC/ qP/9K6mTOj7ATUNL9fzM308GM9XWGM1Pl0TfjWnGAct2k/deRLOeXmc/Cil6SsCOuK16/N aYirJIMhFt5pmHiwvRRuoliT9/YNvwc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727904348; a=rsa-sha256; cv=none; b=uJ29YFyBkGPK0fyPuhV5Oo2njLKyUfcEHK7Aet6HttCE4Wrd92odzPcYH6M0+JqdjniSFE 2w/Q079X6fX3IlxByJs1jIB8RLrKSR8PeEgEKdm/mypsgZXRH6lyLbf6grqGuvjCQS3zVZ hEOrY36xdHIUbZJp6v90ESCuRBWSsB0= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uXWl4i2t; spf=pass (imf24.hostedemail.com: domain of jlayton@kernel.org designates 147.75.193.91 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 nyc.source.kernel.org (Postfix) with ESMTP id 447C9A4401A; Wed, 2 Oct 2024 21:27:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 914A9C4CEE1; Wed, 2 Oct 2024 21:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727904476; bh=9HLO3XpJ6HpHWAPYsUm3tCO/nrjDoz9ag2++QNPQia4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uXWl4i2tOgGIMLmuU2mUUroSOWL29/JUAjRh0jzUJWdMog/Qki/kBoa/LFSdc2CUU pbqa6d6QQFcznz/kcCHUnfBl+25eDBB/bQYt/vvfh8OZEglDW3g8h5YdVUtCjUJk7b UfrPAvDtVdFWByOtLKzs+YcAcV75KOpKC8mHwHCuEW4JgLL7C+I/NtrpeJleBPEiz5 tR6gVzMvmjn5B2Iz5vobADmFD3VOCf+5OLU0HnF8a2ppRPEpGzBJqgqgBs1vpr/i/h xH5/4CE0eT8F0g38OYLaDbrwU3mpOZ+7mD6rmrfrTEeZSTGIi2IjWjnuNmmcOsesiL oPkUk4nFRh92A== From: Jeff Layton Date: Wed, 02 Oct 2024 17:27:24 -0400 Subject: [PATCH v10 09/12] xfs: switch to multigrain timestamps MIME-Version: 1.0 Message-Id: <20241002-mgtime-v10-9-d1c4717f5284@kernel.org> References: <20241002-mgtime-v10-0-d1c4717f5284@kernel.org> In-Reply-To: <20241002-mgtime-v10-0-d1c4717f5284@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.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3180; i=jlayton@kernel.org; h=from:subject:message-id; bh=9HLO3XpJ6HpHWAPYsUm3tCO/nrjDoz9ag2++QNPQia4=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBm/brAZIqVIJKeyaxoHylxGxKgRPgUJZI1VhJRj ZnV5Y921g6JAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZv26wAAKCRAADmhBGVaC FUffEACv5L7rnY+EMR497bJG5/8S/s1wJUfmdxaoCDG+LnQbH78d++nzXjCVGoIfX/y7IJQDIfn gM0wlLMYm/efC/7UmR9O/T9jiLQgBrRtaYaPLRcn3puzRSl5C8bOeZ0l3/jOe+501U/1OnL556c FyiMZQsOWor4MSyzHHPbU1rY7gk549eNccvj+67f3WpNM6Zn9CHM7dUv3QxvweREeQo3FRm0+jN CV6uf/GSmzRs8LBhKUpsiqMSBi1unsyQTPnOZBDWdo79OU8tsyUq0vWEOxYGMunxNJNyX/lfjNC hXAZAgp1zWvKl/M1z2GlAIq6y2iez2Vi7H6zrizbo8maTFOf/4wb+de4PNAPQoYK/BjVGiPcSpz uRhGofidblAaoZQ8LjepNkc6jtOKrOMd4qzluTWZ3TFu6JMP2hbkupUV/0i4NiRpOzHFUPxIHcT tM+QAnh8ULcL9xo1NVhsl0FZ/l9s55MnO3A/QoR/FMr3JiT/d6j2t3Adtn4FVTk8VxZjJMldfdw IWbxlJEjfMlYoSmyYGh514J3VI0jNyFV1sAi5fJaZBzZRDVToqGzcd6wQa7KavYEMC2FjZwhfuB TNkWp8Rnabq2rXR4Wq7krJUS3NYKYM1WY6gRph1rGxF1TfhvTaOucrIB1uPPyWY9Y3fdv6EPg0N rjHopf6H5bbG1NQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Stat-Signature: jjbpbzq4x6hmse4d1fdyitrbg9h3qasi X-Rspamd-Queue-Id: 729C518000A X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1727904477-426923 X-HE-Meta: U2FsdGVkX187eclVbMGe2rWEjJgcjaIk+FSyxXLzHjXGcFrb64pq9aBeFXzJgLhCOm4P6UpmOcRETDXEh0x4a4mr9ONykoC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yesgEGNfNSOjr1O7pLV4Oole06WxolU+7MHLwkLJewpuAu7qFI1+z17fQWfbbduSUZjJ0Fk/CuMHRecoJNX0QHML0WF2u2j8tM3slCMUy+KCtnMVOm8aE+nOEHvKrGA1y3ot5g4rHldcKtpJgvtCQLncgFu8MFGwYlGoXLRMXi497AOH3TFrkvTs14njbvLzcKUvxgs1KSXANrOzd8GVAhKHExXMLk6CDavxyw4LdzSI0pwyyGewJcfR/LD+JsZSvoDKX5tMp25iVWNblVt/VJ742VG7YL9XJf/ClcfD6RlOBNMVb 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 3c40f37e82c73cf871bb252553331b60c6b1973b..c962ad64b0c10058c1e2eecf664fbc67ec7302f2 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 1cdc8034f54d93f4a40ab3e3e4f91c6c9dfed7ec..a1c4a350a6dbfd19028ccecdfdb271879f769ccb 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 27e9f749c4c7fc75c3385aba2e02ac9fc5d1719d..210481b03fdb48fd50e9a7a109d8bcee0e7e3a29 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");