From patchwork Tue Oct 1 10:59:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13817782 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 BD1D4CE7D0D for ; Tue, 1 Oct 2024 10:59:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA17A280079; Tue, 1 Oct 2024 06:59:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF58C280068; Tue, 1 Oct 2024 06:59:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2BDB280079; Tue, 1 Oct 2024 06:59:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 98B5B280068 for ; Tue, 1 Oct 2024 06:59:38 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5AFFC120FD1 for ; Tue, 1 Oct 2024 10:59:38 +0000 (UTC) X-FDA: 82624737636.09.3E9D1BB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 9A55640003 for ; Tue, 1 Oct 2024 10:59:36 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OBF7R15b; spf=pass (imf12.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=1727780337; 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=cckz3p8HeZ7XKfyqcYCtDgyKzu4arTXpHRZYzAXxYAw=; b=cLmawQqT4G8hd45zbXcb1bZuXP7Jd1pEmK6rdwMiHoc9hqLv6MU2LsrHVSuaRhTotLEQmV vEYEiYe1LIjsssuLa6dwDBpgH/DAOdoesUBKPIxEQMiB64/nk24YGYbfmuLucDbU9cpzpi bqMgGv5LZENrYTrugVhlQCHonF2gOnM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OBF7R15b; spf=pass (imf12.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727780337; a=rsa-sha256; cv=none; b=j4WIy5OgBQPyZ9Vby7Hl48R0W/KAE7dj2KOW0+cA0MbqG9hw9xHBvIxm2PBfBfGfCEggte LpgvDNJuItY9G24FD8QuRlt2dCCri8PlKH7jA4NfM2PgsQ35GlLEmQ+5wG0kjun5BNI552 yNMWOK/A50Zjn7aIUlpHH9BT4lZHEkw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BCD675C2779; Tue, 1 Oct 2024 10:59:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF78AC4CED1; Tue, 1 Oct 2024 10:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727780375; bh=m2lMTjAgLXYxRt3GuKTCEjdRkZam4zPki2ETeaDm/ao=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OBF7R15b9rIqKG+pvtE6rj6OdW0IgTIhklVWXvyfUcsAXEMiM+5A8qs8rYSkp6MC8 WzVD1hANjS7mrm4m9IIzd7x0nU4N+ZQ0oTnkeZzxiWtA7aZ0Q2zGiCcWu7rNV4TDvv vY5EZhnCloVawAC3X0cUHyBeCgMoFAJvdg83/nwaFXGrYvxuDVPp5j/1KFrwxAPUmc nw9YRak3vLrzUcqSw/dL8+Rfg2LfFMeBxk61HLuWD0RUW/74imBhdVzQxLTxVPfZ86 A8ckKa4UPYviPwNPHQ2pP0W7sF7oCdsCZsB4gHDbafgswTs3QldFrlY9qPIW5r5+PD AiNA2CAE8nGow== From: Jeff Layton Date: Tue, 01 Oct 2024 06:59:03 -0400 Subject: [PATCH v8 09/12] xfs: switch to multigrain timestamps MIME-Version: 1.0 Message-Id: <20241001-mgtime-v8-9-903343d91bc3@kernel.org> References: <20241001-mgtime-v8-0-903343d91bc3@kernel.org> In-Reply-To: <20241001-mgtime-v8-0-903343d91bc3@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=m2lMTjAgLXYxRt3GuKTCEjdRkZam4zPki2ETeaDm/ao=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBm+9X7GLL7kNWVIqPbkvgTfkIdHSTFGll+0bhu5 4aE3jIwHdiJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZvvV+wAKCRAADmhBGVaC FaInEACrL+q8404CLEi/39DzITks0kx3KFB40IxDLDYM7C53Oow0+1Ouq7o4SsV4HwHWj9/+gUk VPV50u0AiO/cfPNEGjdD94ahfvh7mWZitnVrIoEjaxeRFWMnJdt9boNh7PSwMvSgbsQxKwDitEA xQc6nANNzxjz+taw7eMsTn41hLmZ2CYkEgr66NyNh0H4sRGPh/9SbYeuGshQJ5r9jHcXxEGBoEc j1IuRH4zy++45mvBxNn73FDMnWTFcjdkmmp+RFJsvdDNv/wdPVIDBQ8vQvwHUwSG0M1/y/s3z5j t9hpYhjJ7hVbCWtjI6xliIjp20ftnaNG2gjVzfU1vQZZmjYypYiwSNpuavnnMOmyqumq3Lqk0Lp b/ucLYQc/TjkkS4Rp7RVFxq1FE6nP9df9YQ0+itMOwTRnLnz7U6qGL5jI9uQkb/GeGbURVaH0kX rKd01G645FLE8KuX19ir4hMW8hqMjaNux6D664rxNlVaqH0O5806S8ntjhRcm4K5a5qCtDSHAsz 59gKIxPSNxFFFRxbX/ua1Djl68hWL9viBhwV0HF/k8kwxGKSPeNdYcKfDQi/E/MnjFPPRU6gh0e RU50fMUFq7x5jUN/T4sFPyVEyDtxRONRQCMUIPkD1/6dEiU3Ybt4li3Fb9gN0c255JmbZOohyj1 5L1Zb+qBAeoVzdw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspam-User: X-Stat-Signature: 55epkzwos7369omgdugwa8oykjoh15pf X-Rspamd-Queue-Id: 9A55640003 X-Rspamd-Server: rspam11 X-HE-Tag: 1727780376-312673 X-HE-Meta: U2FsdGVkX1+6AfC9MPrrlxyaG/k7UE0hUu6FOq6jOSB8c/qhnBzbSJ5L0vLw6y0qF/xmxEl3OKfGFFkNwLKwhadmU0eL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NMV5SxLLNtWWEjcaLgyp6VlJ7Llc36Yve1Cr4zfmLX75ThPZglS9sk2hmmBW+F2Zr/9bH46UEupOwr2fTvCvtAqpme+1MHae9IUzRcHyged21dyiy84BdI9A0QZSPveoxIQrvYzXwk63bsgApGP/32Zdgp8nnEOs84E7LCe77JE9PeYrJw1fOKz2+3hh13mI= 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 ee79cf161312..b5d0c5c157e7 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 fbb3a1594c0d..fda75db739b1 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -2063,7 +2063,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");