From patchwork Mon Aug 7 19:38:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13344808 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 5A5CAC001DB for ; Mon, 7 Aug 2023 19:38:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CACA36B0072; Mon, 7 Aug 2023 15:38:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C35D36B0074; Mon, 7 Aug 2023 15:38:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A89C98D0001; Mon, 7 Aug 2023 15:38:50 -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 971366B0072 for ; Mon, 7 Aug 2023 15:38:50 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1D493140933 for ; Mon, 7 Aug 2023 19:38:50 +0000 (UTC) X-FDA: 81098321220.13.DEEB95C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id 3F49E1C0013 for ; Mon, 7 Aug 2023 19:38:48 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qVA0Ix0l; spf=pass (imf18.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=1691437128; 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=AV25GXXjbfhny01pu5q6ETzgPzLaYRTHN2gggOnuQIc=; b=ogW/MNwn8RcQEM3VkMkHex5CYwoI4zjzb7ut84di+hizeYrEfL7gZTk+mSy6KT32wUcW9a GJnOaZKvSsDVRguqxWsddhlcXZxpC83YTP1byzBlPbj6eGmx09rhs3sYEOI19HMSU+jP5V m4u1X3PcA4JKmOsJMapuM8Bu6x7e2qg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691437128; a=rsa-sha256; cv=none; b=SOjH+9RcHLrmC3vu2k7Nn6H8gJzWZw7K06pn7uSNVMlreVeEXkjphZUpT+e7p+rkJ9XHns qIKGDP3ArMMoZWo/pXE29otQQq1Aru7MrDbNCuVCQUmuURdk62DEcRazldxQpfst+wHvdI YucyH3HXvJKiBNO7jXa3mSKT0rexwk0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qVA0Ix0l; spf=pass (imf18.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 E8073621DD; Mon, 7 Aug 2023 19:38:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 054D5C433C7; Mon, 7 Aug 2023 19:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691437125; bh=9NJxICXmYLBXPMfC64XdrCwzqAF8iKfLe8/dZ5HUTCM=; h=From:Subject:Date:To:Cc:From; b=qVA0Ix0lBGcrjnJMlaHoGn+dmPVHJcXPNwPRNVYPTUHaY6qqAw93e+HMLjVLlc3Ja IhWApauDUcVfJmEKAxeUufIWqAFry217pjJdec6Gnx5t1+ywYk3pNZ8WXdPlRwKNOd OSlQaHVYM2YnEQ+qBkyv9bQY+28OOz6U5Y/c45rbeadHiicXNG4D8cy/yMF2ZxGYQT WF+CZGWrnkMTatxkmUPRWrUl37dNWDGAI5WHVIRN+E3qOc0vGvg3j/8gZRUS/cWeFM o6kKmy9XR+DjgsHsIdeKI6U026YwGTiGD5oZ9j361Mp366ShxOWQxvQ1jUtP+L7u3o JIESFeiSwFvYg== From: Jeff Layton Subject: [PATCH v7 00/13] fs: implement multigrain timestamps Date: Mon, 07 Aug 2023 15:38:31 -0400 Message-Id: <20230807-mgctime-v7-0-d1dec143a704@kernel.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIADdI0WQC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyzHUUlJIzE vPSU3UzU4B8JSMDI2MDc0Nj3dz05JLM3FTdNKNEy7RkYyMTS0MLJaDqgqLUtMwKsEnRsbW1AGM 0/ohZAAAA To: Alexander Viro , Christian Brauner , 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 , 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 , Amir Goldstein , "Darrick J. Wong" , Benjamin Coddington Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, v9fs@lists.linux.dev, 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-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-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org, Jeff Layton , Jan Kara X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=5508; i=jlayton@kernel.org; h=from:subject:message-id; bh=9NJxICXmYLBXPMfC64XdrCwzqAF8iKfLe8/dZ5HUTCM=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBk0Ug9Vt6h3uVooR3L32BzC9FtHm9ZXcj5fgD9W kZjn/QE83GJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZNFIPQAKCRAADmhBGVaC FTXFD/4tOOz/frcT1juvFdX2M7h8GdVQCCM3jUzq8E7v2hZzdNQ+TudlDlEIxe9c16PcuMEkopG +kFNCV6iGCNYHD41A1XVOFEaG1ktWpd4NFo0iZbI38zUAkY1Hq+1jOeJ8bi322DrqAlwoonAz0S xjoCCsczgKHec9BxsuY4jfg7RVOvXrFnrpkUDxIomwZ80NN40sF+XG+bvbNSLZLb5dlTvoeQVQc smZ+JCtorGZdRxl2ILJbhENfex5Z0Cqgyh5A9MXqnl+J5Hm9s1es+lk7e+q9IK18+YypOP1HSHI K4MMDRodJG3ELlDifK8mUDMexXoWFTdW8MdVW5HTGHShQubI6zShgS4psxnRhF+jhlkcLxFz7Ui NL0E8WBVqsxLTUShLtKzEZ5j4wrb8yHur66NZrhvTeqgQwKIouSImzG0S+GAC8xIRAfXk06T/Do NpD+OXK/CELcMQD5+q1WcE7fPstPcyNp2PfOjHsnyMEzzkXXe3n1aeImG7MmCUDsftccGNQtajU WpL+Dq+bljKjojhVg9eJQYbnM0hNchEPUfMtAsdaFl7R/fRVlwsD+brmqMnYjtUGL/EPcQK+KrS 4PhSQm9PfqdGsTZlG/r+wg2LxN9mxhg3X4wHeNUKI7S2IrJnkf5g6P8SBMSBluFrkbUD4n8Ko27 OYH1/EhApgN3hYA== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: 3F49E1C0013 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 93kpt4dqjzeag8wnmk55qs4mwccqn97p X-HE-Tag: 1691437128-284194 X-HE-Meta: U2FsdGVkX18fZR4H6bjYjQkTfjlh9H6NzARaz4kzIdB0KQcSCWhjFfKj1JpnUbYpYKrFLL1fj5weVodeIPXY86lBF2yYMy59LhR3mbiRoESm6J0PY8UH87lHBBOlKgGzozFlp7OXLO/Ou3emm8jdRalFLpz4ySkkFllebDCzZXrJISjq11B/t9Bxf3FRSpNnKSlEC+4h1I505LHgBseJYdjFtdaWVom4BgNjnPFHIS1AW/BMct74nQIue5Uv1supN3BcoJR3XrY4+Xc23+PMvJivHh0PjTM7viEDh8YsRpx1VgapXgs5VJzAJx0yi6RbfcUcqonksg53HHOvzs+5eHavKZ2KIDYxdhbdUtE8NfyZPsMMojDpvoI//q62g4S1MkMI3CeW6DJwwUj/NmoVhkyayNjhaXIHLRO78uaTX3fAkh6SbIa83xFcJQ+YgFKwuR6odMB2Qk5eM1vonK15jqywZKYcySYYJXxbn+bcYG/9vnxIGd1gSH9GBEj7jXaYIxoLhXkRCeVWfWC5aKxgyfVXHiyUKugN2ViqzApWT2XKpuyhQZbmsEB+y3mCaAmS7q2pTQbDFIysbCy9EyTsd6VhHVqeEOyhB79KBqqmu0DkkPibLalxoZKhGip5OyFlwCBdEBAGWi/bMz9n0EB/FTjLrCHLUwfnsRLA1Z5a8STSQRZ88OxF137egHtkPKY6lN1z7ECVKBfrGe//P8cvDAbqPE+9fhFjOmtGEwPs0zQ08VCh3gt7+Mav6DgO3pv+0HdjN350zPdeDvCi5fWyjjGdZvvv9OAmt4h0aNAUtv6T8fp+uP6fsT6ccCS4BH7PKOjVMIUfY4OzNuEc6Z0hIkjeQCc9K7MCUuiswmd8/JotgoGRoS+sbiFIJJAdexgtx/rZzeO5k9PVBsgMbAo2xvtS+JRPWpBBxBGxfiEohM1ScIXYo4hpBUIoCCf75LBjSvIr2u2uvbfolKYGwMK l5YlHaV4 PJV/cN62yhGbQdl4DMG/qdPxfJOrCKx5fGtDnc/5Ub8CYkaaiYpnU123HD1HwXqelxv0t+ebV58arJB359XBArXrs9DCYkVCxjo66D1DeYEfxo+4SPy4VOGx2WFhfWlkQozfC4yz7BptCc5yXYAzkfXjFdVKDwPu8h95MVsvVbaeo6uxcSRabspHJMZv2TMpCtmoIEUwE12SZts0H5arGUEHc09wu4XjWv1PFnSOPNRtIaPHySvD6MfPqmpWLsQ04PBmpA2wbcRTL5XDb/0pgCP+DyxztEmMh9UNI928760WBoYCab84ryifhAGU1itUKe1Ek/59+egM7RGMCrqCXuLe4tBcE1KK2+xXV 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. Credit goes to Dave Chinner for the original idea, and to Ben Coddington for the catchy name. This series should apply cleanly onto Christian's vfs.ctime branch, once the v6 mgtime patches have been dropped. That should be everything above this commit: 525deaeb2fbf gfs2: fix timestamp handling on quota inodes base-commit: cf22d118b89a09a0160586412160d89098f7c4c7 Signed-off-by: Jeff Layton --- Changes in v7: - change update_time operation to fetch the current time itself - don't modify current_time operation. Leave it always returning coarse timestamp - rework inode_set_ctime_current for better atomicity and ensure that all mgtime filesystems use it - reorder arguments to fill_mg_cmtime Changes in v6: - drop the patch that removed XFS_ICHGTIME_CHG - change WARN_ON_ONCE to ASSERT in xfs conversion patch --- Jeff Layton (13): fs: remove silly warning from current_time fs: pass the request_mask to generic_fillattr fs: drop the timespec64 arg from generic_update_time btrfs: have it use inode_update_timestamps fat: make fat_update_time get its own timestamp ubifs: have ubifs_update_time use inode_update_timestamps xfs: have xfs_vn_update_time gets its own timestamp fs: drop the timespec64 argument from update_time fs: add infrastructure for multigrain timestamps 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/bad_inode.c | 3 +- fs/btrfs/file.c | 24 +---- fs/btrfs/inode.c | 14 +-- fs/btrfs/super.c | 5 +- fs/btrfs/volumes.c | 4 +- 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/fat.h | 3 +- fs/fat/file.c | 2 +- fs/fat/misc.c | 6 +- fs/fuse/dir.c | 2 +- fs/gfs2/inode.c | 8 +- fs/hfsplus/inode.c | 2 +- fs/inode.c | 200 +++++++++++++++++++++++++++++++--------- 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 | 5 +- fs/overlayfs/inode.c | 2 +- fs/overlayfs/overlayfs.h | 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 | 65 ++++++++++--- fs/sysv/itree.c | 3 +- fs/ubifs/dir.c | 2 +- fs/ubifs/file.c | 19 ++-- fs/ubifs/ubifs.h | 2 +- fs/udf/symlink.c | 2 +- fs/vboxsf/utils.c | 2 +- fs/xfs/libxfs/xfs_trans_inode.c | 6 +- fs/xfs/xfs_iops.c | 25 +++-- fs/xfs/xfs_super.c | 2 +- include/linux/fs.h | 55 +++++++++-- mm/shmem.c | 4 +- 55 files changed, 368 insertions(+), 192 deletions(-) --- base-commit: 525deaeb2fbf634222f4231608c72190c551c935 change-id: 20230713-mgctime-f2a9fc324918 Best regards,