From patchwork Tue Jul 25 14:58:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13326616 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 48893C0015E for ; Tue, 25 Jul 2023 14:59:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC22E6B007D; Tue, 25 Jul 2023 10:59:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D70CA6B007B; Tue, 25 Jul 2023 10:59:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BEACB8D0001; Tue, 25 Jul 2023 10:59:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AF80A6B0074 for ; Tue, 25 Jul 2023 10:59:27 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6E9F740E7E for ; Tue, 25 Jul 2023 14:59:27 +0000 (UTC) X-FDA: 81050442774.06.2AB9D16 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id 7A534C000B for ; Tue, 25 Jul 2023 14:59:25 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=alZ0gxYy; spf=pass (imf28.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690297165; 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=8tog9VQDhF1pkUSuCTCla4dx+TOV7kNYrS1AT7YdfDE=; b=3r+OmS+6U5otJBNPFW7oz6DuZ9DqwNRQZfKyF0K18+UYKue3o0chJHCIYLZodSuqNI+tys 7Wcr+MAOhwKNUmzKLiDkAVt4jP8ltSlzXbKX/2NSiI797Gs2t6gg2AczTIiIrtfL/hodWf dUHi4k250lgma/eEqnqbU6OdRvpfiZo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690297165; a=rsa-sha256; cv=none; b=xeg2WanWAHJdRRWzC7J6pn4cUMX93P/VnDq4cptRbjaAumVkHbfFdXFXQYrGrvU/exd5pq 1pvx1CzBvrLi/wtIthgjHjK8QJzLE9tBb/znSWjSrT4Lza0YsLCkvPGXPU/Xbvn3/Q5xWn h65WnyNBGkMtZU7nqH1DHb/y3dFu+Ew= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=alZ0gxYy; spf=pass (imf28.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 79AB061782; Tue, 25 Jul 2023 14:59:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B79EC43391; Tue, 25 Jul 2023 14:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690297163; bh=2wyPg6r9LV0rMw3rwiDdQz97NuQm6trs7Tz3krXz824=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=alZ0gxYy+IkbheJTJP3qA2iEk4eNxl7eSGrfIs+MxZSUI5FjVlgNKYG5ztKp3Air1 gU0wFT7ZCjZL97L1pSzjV2gLHwstvP7MB6Z34if0oOLpUl4yCyGO8lfYx/uM34yD1h 9LZWMe7lIPe5nXOW07yRzmCzjlvxPbX1ZXW44vy0Pu6/7l4Z9vUIrk0XHzxH7FLSn0 Zok2yVBZaZarTyEeN65Qsn24kYQ8HA3DH5VcBZbywjGCZx1K80THvInEU4Q0j5ZfkG j9JBRdKpKVrkp5Bentl7GIljUepcCHIJlPZHHNjpgnyCCT/2W0WCPCo/TCZpXZWlzT vUIjlakd0S9oA== From: Jeff Layton Date: Tue, 25 Jul 2023 10:58:18 -0400 Subject: [PATCH v6 5/7] xfs: switch to multigrain timestamps MIME-Version: 1.0 Message-Id: <20230725-mgctime-v6-5-a794c2b7abca@kernel.org> References: <20230725-mgctime-v6-0-a794c2b7abca@kernel.org> In-Reply-To: <20230725-mgctime-v6-0-a794c2b7abca@kernel.org> To: Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Chris Mason , Josef Bacik , David Sterba , Xiubo Li , Ilya Dryomov , Jan Harkes , coda@cs.cmu.edu, Tyler Hicks , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Namjae Jeon , Sungjong Seo , Jan Kara , Theodore Ts'o , Andreas Dilger , Jaegeuk Kim , OGAWA Hirofumi , Miklos Szeredi , Bob Peterson , Andreas Gruenbacher , Greg Kroah-Hartman , Tejun Heo , Alexander Viro , Christian Brauner , Trond Myklebust , Anna Schumaker , Konstantin Komarov , Mark Fasheh , Joel Becker , Joseph Qi , Mike Marshall , Martin Brandenburg , Luis Chamberlain , Kees Cook , Iurii Zaikin , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Sergey Senozhatsky , Richard Weinberger , Hans de Goede , Hugh Dickins , Andrew Morton , "Darrick J. Wong" Cc: Dave Chinner , Anthony Iliopoulos , v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@coda.cs.cmu.edu, ecryptfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-mtd@lists.infradead.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2386; i=jlayton@kernel.org; h=from:subject:message-id; bh=2wyPg6r9LV0rMw3rwiDdQz97NuQm6trs7Tz3krXz824=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBkv+MkP4yvT+W3sEtTwUyKNN0Eo+qCCd0hAxl+0 h4C0zNUhdGJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZL/jJAAKCRAADmhBGVaC FeBjEACUyo8TVL0skmaKxmt9N9nKbRC1TSdvVtM4yiwxJ8jEsCm89ngnhuv/BuJpe41Lx5wb/iz dmMFWHzJRu2aCWptETR3OPCB2GrAR7iNntPS9+gNC6m+5BqrCE02YO3lUtUaRUAYl5OC8Ri6BBQ OEGhtGXHAEQdKV6DErIItzKARajHjYVOGXQMptrAmfVeqZrMgMdnjXv1BkrB7vTxPnEIiZvpXc6 teMkRXV34FsYAQxvcwm57Mmv+ZzhSEhzQj+7Hi5Fd+/iThWp2ImD7wKtbimsgjidI9ckdD0c5hK 1Xoqn16mf7rIUqDTVbuzYbGQI7meLwVcGOlqdqnPMN1HtuSDkogTkGd77hv9NxndH8aK+N90UKH Ks08xZN4yQjcuR2zIFRUCLsaC33fU+/2m8VEH3iIAIDEuqCogY30aCPWiBS4KwHktS1ry5SwFbm xZAhqbegcfX5h0NU2bjonVVMYypC3Ec8Hxs4E7nRLhsdTAF1PwzkcKRfJjflMTm3AVDbGhzr6a2 iNqi2cULBGY/OkiIc97k83/uxrYZSoRVPtrYbRcPDbTmukKm1rRd6io2dU5p1c3Q6EjIhCyoi2B JMPklYNmRVzbzK/y3yeiwwfKpR8AeSRX5pHEDo1ALd8eLd8NtlYkhsN0E3WvbTaYS8RS42Ee4xk v57B1AdBsJ4Ldbg== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Stat-Signature: sz375ies3wqg9ruk4n9qdehh5cqf8o7k X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 7A534C000B X-Rspam-User: X-HE-Tag: 1690297165-214549 X-HE-Meta: U2FsdGVkX1/SLvdNYETAL2Y43dd/jUPfGWr+YGaubTCfC+5LLPYmfB8+pKD+9kdoW+544RhSMt/FRWRIGx1KTefntMi386rw58tnc2lNjLY3VS23e9bxOk0VzniS8GVnwzJ/Cw6gLQnrxdLlVkV84di2iIdOCJ+8s3O2aUv9VCqk4ZHEdjTy/MQMYj/zMRjznJFSH1YRM4ZuxYuwee261eqFLu3y1itK+96VIEmbS3gX9J/XPvjhq5dBZWfs0tmIqQJm+hx6/KIt3bUln8ZceKx0do7TkzJiBEwlXFpvBBpdb9OEsuINum13ef2xfqCFZpIgR9XQqMZ6Hy4ulK5a6q9NEuPJhxM3byAoEPdeuEKqjD3ZiwUSC86sv0E9zYvlsBEz0JoAZwnDnt4C16xgzk3qNRIIiCHuPalln7tErWTKBS5YSSHypyPO9ccEXagsoUlkcAo6g19HTd6ogVi16/SvQjDvzwzLGco0CyNr1+fGIRrYzvc1l/Vke1UPjajrEHVy6SJo/4uOJaBF20YM9lgmdhWtJK3NmZrvlMAmx5rtm9dIWcZejXUKqfojHqKr5tYaDWk3zKuY1miAu7b7wvx/AWG1QGTKbUKVCdT0/h8BvyXTefQsYlI2CAvVG41+dvT0pITR9vIbDSKc8+V/E+TlVWrjszXC9CkQIvAgti8N6tF5MZum6S7GfetapepF9R9/dNdUU5UXvNl1lUSZR5CpR7QYzsLR6PMMKRPzpbpZwSKu6H0nRZGMKXMP1LFuGY0yglhpsJ0VJSSqc9kQRVhQyYnmI+SlLicp0xN4FxlVMPVEdwm3yJdxf+bWFWQsI6M8ZHZAJRtxU684+nnO1OlzlaTLgA4oPoE+Y2VymCkU261fn6GkT0YUM5natmW0+uqW8ca32EL1b77YVaAIHWFMpqoj6V7Lff8u+bmY+wX0l2bHevqZ6PSZtK513A4nXMbiAr+bsaGYKLGNPxs cQLyCS3t taH7intuT9ByEkDgUg8IXrXpZf+L0GQckqf2hqRsVzjcl2gqQAaep6GFKQalMBV4UkuL4Se7+oNd1J3AEGY6FMyo/ByiM1qy5oP/jhRU5x5flXgf7VQpEdJ+1pVISN2GU6t4/1qhGj369GW0hGIhPk6FGY2FbM+70pY2lbhwgZf7O9BmgyDXIJ2SuRTM0oDaH0FcnNRGE/d9tyaHJLoKUiz4hkotxRSrIUp+A2lhroL87BGfwmmCk2Gg+KRL4acpTXt333LyH/qUV011yxE2mybPZviMVTtZnbyPzW3tTmLLFtNx8jUywdemzdslTPSr1DeETfqe3pLlxj71ORtBdC0pb6SAXno61xdZV 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: 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. Signed-off-by: Jeff Layton Acked-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_trans_inode.c | 6 +++--- fs/xfs/xfs_iops.c | 4 ++-- fs/xfs/xfs_super.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c index 6b2296ff248a..ad22656376d3 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); ASSERT(xfs_isilocked(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->i_mtime = tv; - if (flags & XFS_ICHGTIME_CHG) - inode_set_ctime_to_ts(inode, tv); if (flags & XFS_ICHGTIME_CREATE) ip->i_crtime = tv; } diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 3a9363953ef2..3f89ef5a2820 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -573,10 +573,10 @@ xfs_vn_getattr( stat->gid = vfsgid_into_kgid(vfsgid); stat->ino = ip->i_ino; stat->atime = inode->i_atime; - stat->mtime = inode->i_mtime; - stat->ctime = inode_get_ctime(inode); stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks); + fill_mg_cmtime(request_mask, inode, stat); + if (xfs_has_v3inodes(mp)) { if (request_mask & STATX_BTIME) { stat->result_mask |= STATX_BTIME; diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 818510243130..4b10edb2c972 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -2009,7 +2009,7 @@ static struct file_system_type xfs_fs_type = { .init_fs_context = xfs_init_fs_context, .parameters = xfs_fs_parameters, .kill_sb = kill_block_super, - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME, }; MODULE_ALIAS_FS("xfs");