From patchwork Thu Jul 13 23:00:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312712 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1635C001B0 for ; Thu, 13 Jul 2023 23:01:54 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qK5Jr-0005Qg-Al; Thu, 13 Jul 2023 23:01:54 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qK5Jq-0005Qa-ON for linux-f2fs-devel@lists.sourceforge.net; Thu, 13 Jul 2023 23:01:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Hh/yJgVFsNjzYD+FWMHoMPHZWh1GNNWQMircY/bzoxI=; b=QfmPm6rHy82huP9slcN9wBxyxG lbvOE9JPkT4oM7bH8YFK43ydgAetkYGdFZb6gVuBmte/yUFjdlV+YQCFMKphdFqN91unkWF3FeJkJ 1dYWvUBSmPbBl8BIBxyAv/mg78Fm7++e7k+vdveeldxsD1cyaQhq89vzMdgsJcsiFeKQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Hh/yJgVFsNjzYD+FWMHoMPHZWh1GNNWQMircY/bzoxI=; b=K8Bzb0EMP2kO2B02yVIYvtulo+ fm75cGIcQot1iuViM0VZivqU7wiNOw6EotLo0bmldtOXhvJL+kS2kOY+X4V10VS3afa87F3l0SYFz Z+HXDGGLwzbOS6AMlEKw+FI0Um7jVo5gauHKiOMq5OUHU+wcHVmg54hHG97V0Au+T6sE=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qK5Jr-0006FB-1N for linux-f2fs-devel@lists.sourceforge.net; Thu, 13 Jul 2023 23:01:53 +0000 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 519AA61BB0; Thu, 13 Jul 2023 23:01:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC92CC433C7; Thu, 13 Jul 2023 23:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289306; bh=o469Gn6TRoUgWK1yzrc9Tq+Zw/B6gpe2ALD+iBBNLtc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Dmuulj7MQ5xrcZlRvkmqqt0cLhw9gHOygWjyV1GMrQh2qQIas328YpVrvgYa/9YlE jdjzasvIwgr2pzbKhJ6bkYvRUPUJ7Cf222d3QWzBNDDOHRreW6B5jNpd7hZSqUP0DG 1om1BOfqMHiJVAzIrAkBkZ7yM8hkiudMOoj8eyWVmH/DEftijdI9AG0uCRfjjSpArl vRWtCQtjZeUK6XAELF1K+qzyF9p42KVVOnsGhDho4Iisz00CdwAYHBxCcwNy70X3P4 ejK2Xi/B3UJqCd5vzE2APsFaUo7z38B+tdOnS4hwn6rB/d8Dd39Uv5VG/MGE7hJNYJ 1OevplbSpgwNg== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:55 -0400 MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-6-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@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" X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2342; i=jlayton@kernel.org; h=from:subject:message-id; bh=o469Gn6TRoUgWK1yzrc9Tq+Zw/B6gpe2ALD+iBBNLtc=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIusPIfg6vbYZi6rm+r8gNys41rCFzK3/3ia PhemQOJxaiJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLgAKCRAADmhBGVaC FThOEACcN1l8TjhunRlKxfjl4GEZ1QeEwjtNX4gydoy2OgNjHxlnhXUZMCY77aPaf+2xc/lyobv SSRfjCTqzzl07bwmqkVIo3y7Dxq50Z45QXZK6iuErpWLxQrjjTiVuEtnmMRRLuu+5ZC8MNq74xP cQDdCkZZMe73bLkpfyCPFksXYk2bv+JK0B+CzboQyXxWRMjctEtcDAPG4JYms7znxF1dSXoVylL /J0KhIQ/r2ezXNSqhAMPT2r6o68iDUtaiUytMhVuc0W6TjfSeBLNDmKDnkzC3PKN996ImbU3ZIf b9SMQeCUPEp075x9xcKTdGaEUG1n5P9oJfoFKiV24GIHsQGpFrwdSqL0TygTRvcayvSudZTAzW4 p72Ki0HJ0dZv94qlRvtNf2K69SVBBzryWi3A60MH2db12+d0IpOYFAd8U2R+0L4Oq+yUbcbSfmz W2m+cpeKx0IHdjswC4j0Z6FLkR10k+EDV8ekrW4hkiCtShHlCKR7NqQOevac0gCVYlpGY1SzZlz n2AzdLF7/bZeZMuQyjmso7Fa44qUoVkL89Xa9HEUbpMj8IYhxNGK7hy2jUfl2k45+Xtew7aOMFn jJQ+eCf7d2aslrHcY+jo6SqVZa88+8H4i8F5gVH9xF5kxLuy0AfSoJZuN7Q63Rb0/Rmi66tBkCi H+1guzkn1J2LjCw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Headers-End: 1qK5Jr-0006FB-1N Subject: [f2fs-dev] [PATCH v5 6/8] xfs: switch to multigrain timestamps X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jeff Layton , Dave Chinner , linux-mm@kvack.org, linux-mtd@lists.infradead.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, codalist@coda.cs.cmu.edu, cluster-devel@redhat.com, linux-ext4@vger.kernel.org, devel@lists.orangefs.org, ecryptfs@vger.kernel.org, ocfs2-devel@lists.linux.dev, ceph-devel@vger.kernel.org, linux-nfs@vger.kernel.org, v9fs@lists.linux.dev, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 warn if XFS_ICHGTIME_CHG is ever not set. Signed-off-by: Jeff Layton --- 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 0c9df8df6d4a..86f5ffce2d89 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 */ + WARN_ON_ONCE(!(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); } /* 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");