Message ID | 20230725-mgctime-v6-0-a794c2b7abca@kernel.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2533052vqg; Tue, 25 Jul 2023 08:04:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlG/SIcinDxZ1Jc1CbuQiovcIgekcMG08RafcacMJdRfCv4dalyi1UISQOhHULaZmBVHCwC1 X-Received: by 2002:a05:6402:2da:b0:51d:a488:3b3d with SMTP id b26-20020a05640202da00b0051da4883b3dmr9900224edx.35.1690297488107; Tue, 25 Jul 2023 08:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690297488; cv=none; d=google.com; s=arc-20160816; b=zxhYKsptSf65b+KB8UocvvMH8+nrL5COls/DXO3l2K1Lvj3deK9+BTngIeaaJyPVoa 47NJioeHXKwzvvKFnJf2yn3tUspX7rN2w6rxx0tqtVjgjeK0Eq3R3Uegc3kvZlwNODEL pEmLEUg/VVE7AqHfY7BMLKfI3b+HH9rg7BtvWwBuG99/0hjn/Bg5D0txDNPlmQfBAVmf gVzaDEgDOPL9W4Pn7HKx29+sJ8RubML+zuIefXXU+ZPpheBXAXpteOqf/ioE2J6V/D53 xXfM5tbXiU2g2DJAOmRHoD8TRIfOssr5ru/4BikEzbUBIBaDSqx9wIMR4P6zBM0saD+P wfKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:dkim-signature; bh=GocjAOPmzyscTT3gG2qPG5sm82nrhCcD+0oqPXhROfM=; fh=K9wjQ6SuOoTjgwO2Ijvv6kdOfz8IJvcrrlyk5lYYFhE=; b=yIwe/a/NMJiUWU95thnSKdVFwoklqRKPS6tv1oRsTjMgTvw0HIXY/KUkYfeaHIFPdH yiUsgVDs7WKjFOizGHzPjktOhen5dmOmB58a/Hoii1X+KqySVndCpcRjp4zmGcjd08ii LV6PfyCRjOEeRRnkoI+oZwHscTLDsxSO+IAUVbQr50GoaM2ryCuUvXlz61z5OKGPdJc7 SaOeVjat4w7KjxhsVN8P9Tt+lkvM+8Vmb5Qy8jcbr21z2dPy5kfPPUdWqPfPO5ERHN+T xPQFXj3R1KbGIIV3IWdzWUhHHdrPTEyvH3PUFD/hfNxbpnHH3ANKi4NKkGjA6yFW7PHj zr2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tew70jtU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b11-20020aa7cd0b000000b00521d2800f15si8383591edw.519.2023.07.25.08.04.23; Tue, 25 Jul 2023 08:04:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tew70jtU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231599AbjGYO6y (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Tue, 25 Jul 2023 10:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbjGYO6x (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Jul 2023 10:58:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24B6119A0; Tue, 25 Jul 2023 07:58:52 -0700 (PDT) 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 7D5686178D; 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 <jlayton@kernel.org> 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAbjv2QC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyzHQUlJIzE vPSU3UzU4B8JSMDI2MDc0Nj3dz05JLM3FTdNKNEy7RkYyMTS0MLJaDqgqLUtMwKsEnRsbW1AIV mFAhZAAAA To: Eric Van Hensbergen <ericvh@kernel.org>, Latchesar Ionkov <lucho@ionkov.net>, Dominique Martinet <asmadeus@codewreck.org>, Christian Schoenebeck <linux_oss@crudebyte.com>, David Howells <dhowells@redhat.com>, Marc Dionne <marc.dionne@auristor.com>, Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>, David Sterba <dsterba@suse.com>, Xiubo Li <xiubli@redhat.com>, Ilya Dryomov <idryomov@gmail.com>, Jan Harkes <jaharkes@cs.cmu.edu>, coda@cs.cmu.edu, Tyler Hicks <code@tyhicks.com>, Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>, Yue Hu <huyue2@coolpad.com>, Jeffle Xu <jefflexu@linux.alibaba.com>, Namjae Jeon <linkinjeon@kernel.org>, Sungjong Seo <sj1557.seo@samsung.com>, Jan Kara <jack@suse.com>, Theodore Ts'o <tytso@mit.edu>, Andreas Dilger <adilger.kernel@dilger.ca>, Jaegeuk Kim <jaegeuk@kernel.org>, OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>, Miklos Szeredi <miklos@szeredi.hu>, Bob Peterson <rpeterso@redhat.com>, Andreas Gruenbacher <agruenba@redhat.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Tejun Heo <tj@kernel.org>, Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>, Trond Myklebust <trond.myklebust@hammerspace.com>, Anna Schumaker <anna@kernel.org>, Konstantin Komarov <almaz.alexandrovich@paragon-software.com>, Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>, Joseph Qi <joseph.qi@linux.alibaba.com>, Mike Marshall <hubcap@omnibond.com>, Martin Brandenburg <martin@omnibond.com>, Luis Chamberlain <mcgrof@kernel.org>, Kees Cook <keescook@chromium.org>, Iurii Zaikin <yzaikin@google.com>, Steve French <sfrench@samba.org>, Paulo Alcantara <pc@manguebit.com>, Ronnie Sahlberg <lsahlber@redhat.com>, Shyam Prasad N <sprasad@microsoft.com>, Tom Talpey <tom@talpey.com>, Sergey Senozhatsky <senozhatsky@chromium.org>, Richard Weinberger <richard@nod.at>, Hans de Goede <hdegoede@redhat.com>, Hugh Dickins <hughd@google.com>, Andrew Morton <akpm@linux-foundation.org>, "Darrick J. Wong" <djwong@kernel.org> Cc: Dave Chinner <david@fromorbit.com>, Anthony Iliopoulos <ailiop@suse.com>, 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 <jlayton@kernel.org> 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772405378771642377 X-GMAIL-MSGID: 1772405378771642377 |
Series |
fs: implement multigrain timestamps
|
|
Message
Jeff Layton
July 25, 2023, 2:58 p.m. UTC
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 <jlayton@kernel.org>
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,
Comments
On Tue, 25 Jul 2023 10:58:13 -0400, Jeff Layton wrote: > 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. > > [...] Survives xfstests (tmpfs, ext4, overlayfs) and the fs portions of LTP. Let's keep our eyes open for any potential issues. Past suspects has been IMA interacting with overlayfs. We'll see. Picked everything minus the tmpfs-writepage patch that was contentious. --- Applied to the vfs.ctime branch of the vfs/vfs.git tree. Patches in the vfs.ctime branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.ctime [1/7] fs: pass the request_mask to generic_fillattr https://git.kernel.org/vfs/vfs/c/0a6ab6dc6958 [2/7] fs: add infrastructure for multigrain timestamps https://git.kernel.org/vfs/vfs/c/d242b98ac3e9 [4/7] tmpfs: add support for multigrain timestamps https://git.kernel.org/vfs/vfs/c/1f31c58cf032 [5/7] xfs: switch to multigrain timestamps https://git.kernel.org/vfs/vfs/c/859dd91017dd [6/7] ext4: switch to multigrain timestamps https://git.kernel.org/vfs/vfs/c/093af249eab4 [7/7] btrfs: convert to multigrain timestamps https://git.kernel.org/vfs/vfs/c/b90a04d1c30c