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: 13312721 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 39CA1C001B0 for ; Thu, 13 Jul 2023 23:01:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C16A16B0085; Thu, 13 Jul 2023 19:01:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC7006B0087; Thu, 13 Jul 2023 19:01:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8F108D0002; Thu, 13 Jul 2023 19:01:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9ABCD6B0085 for ; Thu, 13 Jul 2023 19:01:50 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2874EA03D7 for ; Thu, 13 Jul 2023 23:01:50 +0000 (UTC) X-FDA: 81008112780.14.3BF1F45 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id 1ED6D80004 for ; Thu, 13 Jul 2023 23:01:47 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Dmuulj7M; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689289308; 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=Hh/yJgVFsNjzYD+FWMHoMPHZWh1GNNWQMircY/bzoxI=; b=kxIVZn5Z4OzieMVmrOcl3c8dd4iCeY2mc16QFsQYBT+MHDYp6DhVj9nqVkrGGCl8uilQx5 4IWBK26kKcgptQBAdArtVWWt7y0fVnk43wIgPgNK3zNoWoeMBTySNlRQXDjTNUuQw8ExXt WeERSO5K+lI0jOC709cYtb4/Z5CLjcs= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Dmuulj7M; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689289308; a=rsa-sha256; cv=none; b=OYZN9zdxOTF+hZ4oBxHZPINwxTFtR7NKmBDjs+dHm0guO4KUkHXsOarZFHc4S9yD7PCxLx m9KsE15Y2Q25OiBW6ofnb2wd+VpOGwa9HYcKwrDeIopHoEWdszvLVvE+rJUEHksxLe7jDB nKmJiv3a/8AF5it/1Fl1TpKfEt+VNr8= 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 Subject: [PATCH v5 6/8] xfs: switch to multigrain timestamps 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" Cc: Dave Chinner , 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=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-Rspamd-Queue-Id: 1ED6D80004 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 91u1k1868i9j1et6hrmrj8i8713szz4o X-HE-Tag: 1689289307-978562 X-HE-Meta: U2FsdGVkX1+KVBOGNfyBCjJtSmrM+IphDy+X/5+jNRor2DBChSH8/CJV//y0sJz7hWhBy3EWIZeHm8oAcHMWeujWMr/YHe4/2/GdTEwLI2K+EOugN2op1yeSM7lSv13/qV1kFUIESOKi/zE9A39B55KHFfcngcjn9vH+UoF98CBZq8XhJqets+4Wg3DRyS/EPDRQ1pN8KsaLeHP0gZN8Ox2yM/OltS5SiEEnOLTckhZ8/HBuZXKOE7jimOqsidxSR35m/JlTSjqAa2eiJNHftYWldYhbOJeGmfmgiHBwM/gIscJJ4KDHpKfZfnGJRuoDG/9Zrup8ah2l6zQInEcy+dVAVGdx5sBbYxN86bJ9e2Yr+aP3udGhju0DUvlFXfP8HQAw7Onpc5rimGbhGk1vflQmM1lMmwohF+ILm2XlRBVj3X4pv9S3nH9JfD+pWPQl8mGc0WXdat0+WtLHrSNbpQLegd9Wto7qAwO1BFxOaIUjO8Z7L7D0uO6+CnKWZi9yn9CbqAv2+EDCKsurUCK4xS4JU79CgJo1gfEWlcC5hBXAeQr4gHDBzTo8wih5OGHaPExHPmBV6pti0d2FOpv+JrvP3jh4tmJgJQ365ddmTExUrHKoeQfGS4pOZZdyi3ExDJBufeoEKtZ9ohfEeeRy9xVcuEWa5REct0uMjO1wyYe8Wv0sXwb2EsD361fZvaT5RgyLlhwlmlO5PkJ73AX9oomd1NWTXYYmBEl+7EV08oVhOssz0LH9l6zh27HD9IYkX/OKKebGHQ4Siq8KmPdCZ8jymIb1ldXP2vDWQR/b5JbaJmh7TLlcvsc73tFpx/3xMxMAUKAb/M1dCyqnxCD98TQodz1lqS1r5UDCopseCDGrNvmQ9NSKYiiFtmzqP+tXgzbcxqtkRsk6V947C7eV5tbVi3ZY0RZaU04lziIDi5LSk+WhJo7O0+urYtK5nrZTYHL5vw/qXrUNn5rI/Zt s2gH0IW0 f8oc75qOtdN0eMgklmE1fAV2x9N3BHLxWsZyIQO/sQ2Xh4M0vo7TFBf+Nip32CZ4CzB2/AnRjPFHEubEqyPdZo6sqebF+AcfpycpzPRDdZzfCKSiXU3W1GWVubaFf9vHnqUJEqTO+TjhPoCKfpPLFG5kXWOsid/56HphCGtj/w0nkJ8hACBym1yUyLrC1eBOJCLxspOdj61zeUxW+S/SLHjxmZtOpdmYfA6l9KYRvdWqdgBdpNCEUTncEU8uxMvJLK3W2y1Gqab5ofV40hIR3sOWI1gRwZgQMGc8rUnsArnTDzjiD1AEcBxkAfk6lwtGulZDd/petbRVS3nsaswIGVvCLDx7v2b61rGcJ 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 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");