From patchwork Tue Jul 25 14:58:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13326611 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 69A8FC00528 for ; Tue, 25 Jul 2023 14:58:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0543C6B0071; Tue, 25 Jul 2023 10:58:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1F6C6B0074; Tue, 25 Jul 2023 10:58:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBE856B0075; Tue, 25 Jul 2023 10:58:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C66436B0071 for ; Tue, 25 Jul 2023 10:58:54 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 92BBA140314 for ; Tue, 25 Jul 2023 14:58:54 +0000 (UTC) X-FDA: 81050441388.15.886F802 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf20.hostedemail.com (Postfix) with ESMTP id 836861C001D for ; Tue, 25 Jul 2023 14:58:52 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tew70jtU; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf20.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=1690297132; 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: references:dkim-signature; bh=GocjAOPmzyscTT3gG2qPG5sm82nrhCcD+0oqPXhROfM=; b=I6k07aZ0Wtrd0dxb474FiXSBH9cfN2w0mv3REVdIYL/TgPnDbAjh3TYiP5O6D4aFsqgvkW ccAULdsPNXNjpRSQx3ANIkMtLOajtBSG8X1XPg5gB1IXF0+x3bbxqIq0HpXXkKz6pWQrRT mp465IZW+EIn1g/zpGagxyf7XU6Oh/w= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tew70jtU; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf20.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=1690297132; a=rsa-sha256; cv=none; b=lZFxxguF//UfEVp99r2zbZoQBAArmNcGzgVi4/tlxl2vujUUnDP85RrXuNBFVGanfUvB8R /z0KQN/Jc09VtApK17x/RJdcJ7yGfhHvxwzSjNKuP4d5EQXq9aVoI6F8yRaL46r6jRUoNG /6s6k0++NoAw5K7+ER4p7lEPaeBRVZk= 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 7709061788; Tue, 25 Jul 2023 14:58:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C1AFC433C7; Tue, 25 Jul 2023 14:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690297130; bh=kJmXJEYOHolov3dHsrtrgrStBu4dP1/spGmtmesqCM4=; h=From:Subject:Date:To:Cc:From; b=tew70jtU4OJWY1VbyooHq/A2VejA7/kDYVzXCKKk0H55cxVTHNA5fhMx/XsjUHQdE k5N+TCbrt7BP6IVsZV/kGZrQ02GB42Vzuf0A/KFgIUnPd4ROGpWY2ZHkqKjdfticNu OMaM7K65I6mQEbZGCqcmN0tUAgZUl/rzmSoYBUrwJChy9IKciiWQK4nWbSqxwsObTI WPQKI9eXf8A84+Mo2pDjNDrS2sLAG7LjBgXOQD6AC8ZVS0weRNDBcGZHDJasTY4XM+ XZNGcH/BVwcKp56pkarr6oFqhSjNamDWitCJbkz8MEmn3MzaR1dixLan1haVIWlNtj Ymp6wr5QNgrPg== From: Jeff Layton Subject: [PATCH v6 0/7] fs: implement multigrain timestamps Date: Tue, 25 Jul 2023 10:58:13 -0400 Message-Id: <20230725-mgctime-v6-0-a794c2b7abca@kernel.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAAbjv2QC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyzHQUlJIzE vPSU3UzU4B8JSMDI2MDc0Nj3dz05JLM3FTdNKNEy7RkYyMTS0MLJaDqgqLUtMwKsEnRsbW1AIV mFAhZAAAA 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=4902; i=jlayton@kernel.org; h=from:subject:message-id; bh=kJmXJEYOHolov3dHsrtrgrStBu4dP1/spGmtmesqCM4=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBkv+Mj+zS9rris6Kf5SxMrXR2Y/k9AOCJ9z8KPq j3S+WlmJceJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZL/jIwAKCRAADmhBGVaC FZ/jD/0evq59eIdKfJ48vhkQ834Ov7dXXLAsoPLIBwuMPbqc7pSVOjxB5ATFSwfM9htZKolZ+oY lIU2tVkrgEvzBSvtptGWRr2sarmS792/ET3Q94ZYyI3yGrHeRSXFOCIw1j7WwH2CAixPP7tV3iI CEyu3vkzTFYYrJrAjpZayoN4FMelRFKm9TkDeBNDMR2dHxzPYji2KfnLM8E0QyicvhzMp748ezo gSFE9vYIQeyfCsc0tsb3+xvNeyfrgwWW0Xt+iWheDXhWb2JezV0qwPzhrTI2o0lUu3y5Ak6moUv mxg4LjTEyDiFJS1gFG359AOMdd1Fqe+/hBI/KRZw1FJgHJNrojM6CcefRT/9ld8QucjdHCaei+j wdbwbxqSPCnXE7EyPm6OfdKrz1QY8quS0w28VGDMEoqvWsdi5KDYgaliGZ4xMdeR24lwCGeO1sO CcTk+9XkDMSViFJpiCvlZ1wqjbcy+7bpDotGULl660l29vxwtUOL4OzsFLorGw8J6AVtpr1WcSZ qiHQFHKm0p8TmStpgYdlGpNtZsiMWV5W5ebzMwtMfdk+ItSXAkX5AccmgWA8SF2Lu6i9FkiaOJK 8np/ZINHFrUnnqcT0RhtcBRNRofFbPWW2FPTzqKgpU9tTsrmpbASbI+M+rPlDhulz5q2G6Ka/vp WLXgwe/aGNDuUZQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 836861C001D X-Stat-Signature: 8s1ztfgghbu4son4fteuby95n4bxigu4 X-HE-Tag: 1690297132-140869 X-HE-Meta: U2FsdGVkX19ONoVUWlPEG+U69zT34P4YNoeHMtLifw+WB0c8iHkXWyNh9NcRmUYEtEO726LTBwr5OL9A9vuW/TSg5yV43heSk2kw5/2lTHkZGEP0UNLi/MfOtGh1vFTYBIzYTJldS9XqPFEbDJx1pkZrT9bCQyMYqKmHIMy+NlyMojiq//PtSWDEW6QrClgjkCOrATmqTgmI4sG1PvUaDV6MbpHuBXVNnu9v0ft98an7KD34oA1Y3cLXdFo6JFlTAOZXWWTcd1iDCrZjFuhjOW/ygT6sZ5jVNAflFfg8AC0ledxQdH7SCow9LNxV3ZB1h4MSS3xtnIgsuMR8FIz+D7rwLqfHNbWJxfFTGmDFUsU6x+WsWDRzIislaGkymnEzD5xiQ0EAdAcyvf86POR5aj87Nd510P4xhTj130mc3n0kqLsnROwjlUr0OWqJ6Hp8YuiFAn73wZUBpBff9kdyd8d0HdJNf0pJAtiQ0eAN1G0O5/KC87h2O7Vt/yZ7U/7ioMT9cqJsh1XGt34Fgw7BIwhIPQLlHu7DRgX8BWk+qtqSVe/EQKjcm1pbqNt1G478n3hJ49lKyMph2XOy3Aeb4lJNFXWOpwiTspJJFXDEYwYBsb2Ncn/qDbiNKpWBEV3ehKSnVfqQboqV3IHqEwcuuE4r4ISUb4CsIdUG/oVa9FXN1ReUfVBut7ffRzlSjnRphb3zcpv/n+4JWR/q/K2IhJRM2nrw0/l2ePRCWdq/U+brMWl+3HKYz4P/WNlm6ZnR59NShvzHfJmwJIKSrG/dU/mfanu6ENgyPwdSryR48d95FlO2YQf4ryhn3OyijAb8Ww+tKzlNbKb7c6FfoLVB8pkXcn+toy99NooPGKRyq8xyRz4P7TkMgD7lcokH2RqBckrP3LiPSZRznYDqO8IOOirskfRxKxEeXqAu9EdajtPOgVPFvTEI2EFgWWqhFrE9bTOqx014+kwBZ/efA0Y 9cwSx2dx q1prurlTersurwgALwnPcYBturWJYQWvTfhFwnjuqpb4e6IZBXTh12FkYCxpjxPf8CvT0qcjBj+sPWj9juLfoSxYtULtokEFr+7RKZhvwLzn1V0cqvlwxxxZSAv0hHS+31TfoRk+Wvzrd9q1riE4GzTJ62gXvrdnkqy1Ujs9Jn/zm+hdnaag+FIK7j7nQhZ8vyvWQRPpiF8L73g075tLuE0m6E5W0uf2bkR/VEW/gQ9nxY/n41aTUWS8n9/SR8cNTupoVQ+o2KQvbPDuOyeKNlJeJQH8b43TTZlnAD2VvT9CPU0tQzp5N/nC8OY+SDGPdPWXndlWXGPgzR6l74SmXrNcx2/l2UTMvmW0E 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: The VFS always uses coarse-grained timestamps when updating the ctime and mtime after a change. This has the benefit of allowing filesystems to optimize away a lot metadata updates, down to around 1 per jiffy, even when a file is under heavy writes. Unfortunately, this coarseness has always been an issue when we're exporting via NFSv3, which relies on timestamps to validate caches. A lot of changes can happen in a jiffy, so timestamps aren't sufficient to help the client decide to invalidate the cache. Even with NFSv4, a lot of exported filesystems don't properly support a change attribute and are subject to the same problems with timestamp granularity. Other applications have similar issues with timestamps (e.g backup applications). If we were to always use fine-grained timestamps, that would improve the situation, but that becomes rather expensive, as the underlying filesystem would have to log a lot more metadata updates. What we need is a way to only use fine-grained timestamps when they are being actively queried. The idea is to use an unused bit in the ctime's tv_nsec field to mark when the mtime or ctime has been queried via getattr. Once that has been marked, the next m/ctime update will use a fine-grained timestamp. This patch series is based on top of Christian's vfs.all branch, which has the recent conversion to the new ctime accessors. It should apply cleanly on top of linux-next. The first two patches should probably go in via the vfs tree. Should the fs-specific patches go in that way as well, or should they go via maintainer trees? Either should be fine. The first two patches should probably go in via Christian's vfs tree. The rest could go via maintainer trees or the vfs tree. For now, I'd like to get these into linux-next. Christian, would you be willing to pick these up for now? Alternately, I can feed them there via the iversion branch that Stephen is already pulling in from my tree. Signed-off-by: Jeff Layton base-commit: cf22d118b89a09a0160586412160d89098f7c4c7 --- Changes in v6: - drop the patch that removed XFS_ICHGTIME_CHG - change WARN_ON_ONCE to ASSERT in xfs conversion patch --- Jeff Layton (7): fs: pass the request_mask to generic_fillattr fs: add infrastructure for multigrain timestamps tmpfs: bump the mtime/ctime/iversion when page becomes writeable tmpfs: add support for multigrain timestamps xfs: switch to multigrain timestamps ext4: switch to multigrain timestamps btrfs: convert to multigrain timestamps fs/9p/vfs_inode.c | 4 +- fs/9p/vfs_inode_dotl.c | 4 +- fs/afs/inode.c | 2 +- fs/btrfs/file.c | 24 ++-------- fs/btrfs/inode.c | 2 +- fs/btrfs/super.c | 5 ++- fs/ceph/inode.c | 2 +- fs/coda/inode.c | 3 +- fs/ecryptfs/inode.c | 5 ++- fs/erofs/inode.c | 2 +- fs/exfat/file.c | 2 +- fs/ext2/inode.c | 2 +- fs/ext4/inode.c | 2 +- fs/ext4/super.c | 2 +- fs/f2fs/file.c | 2 +- fs/fat/file.c | 2 +- fs/fuse/dir.c | 2 +- fs/gfs2/inode.c | 2 +- fs/hfsplus/inode.c | 2 +- fs/inode.c | 98 +++++++++++++++++++++++++++++------------ fs/kernfs/inode.c | 2 +- fs/libfs.c | 4 +- fs/minix/inode.c | 2 +- fs/nfs/inode.c | 2 +- fs/nfs/namespace.c | 3 +- fs/ntfs3/file.c | 2 +- fs/ocfs2/file.c | 2 +- fs/orangefs/inode.c | 2 +- fs/proc/base.c | 4 +- fs/proc/fd.c | 2 +- fs/proc/generic.c | 2 +- fs/proc/proc_net.c | 2 +- fs/proc/proc_sysctl.c | 2 +- fs/proc/root.c | 3 +- fs/smb/client/inode.c | 2 +- fs/smb/server/smb2pdu.c | 22 ++++----- fs/smb/server/vfs.c | 3 +- fs/stat.c | 59 ++++++++++++++++++++----- fs/sysv/itree.c | 3 +- fs/ubifs/dir.c | 2 +- fs/udf/symlink.c | 2 +- fs/vboxsf/utils.c | 2 +- fs/xfs/libxfs/xfs_trans_inode.c | 6 +-- fs/xfs/xfs_iops.c | 4 +- fs/xfs/xfs_super.c | 2 +- include/linux/fs.h | 47 ++++++++++++++++++-- mm/shmem.c | 16 ++++++- 47 files changed, 248 insertions(+), 125 deletions(-) --- base-commit: 810b5fff7917119ea82ff96e312e2d4350d6b681 change-id: 20230713-mgctime-f2a9fc324918 Best regards,