From patchwork Thu May 18 11:47:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13246628 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 02728C7EE22 for ; Thu, 18 May 2023 11:47:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B289900004; Thu, 18 May 2023 07:47:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 86305900003; Thu, 18 May 2023 07:47:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72A7F900004; Thu, 18 May 2023 07:47:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6571C900003 for ; Thu, 18 May 2023 07:47:50 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2F4CC160787 for ; Thu, 18 May 2023 11:47:50 +0000 (UTC) X-FDA: 80803201500.14.24FE102 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id 695FC100009 for ; Thu, 18 May 2023 11:47:48 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MgJKr48a; spf=pass (imf14.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684410468; a=rsa-sha256; cv=none; b=H5MgjvqsmHfgXb6R8XeNzUXFgIz7idf8nOEAOCgdN6enWqNBSf0qhXGvVjZ1rH94lg+qhF KFPt9CN6pFPm4FRw/9YFEbUn3Gm7GbBJ+fg2+xbhWIrTlkbd7RV4zQkBUpqa1XdSQQOvyw sgWIfgMVWkkpFyDmA8psVJNCD1ECimU= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MgJKr48a; spf=pass (imf14.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=1684410468; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=2aeVLtfUoMs9CmVLHCuD+Q53Mq3u6yAZUrvEpxmssTk=; b=BtR3gT2lf8NpYKccWdG7ppkVzI0deqLR/fsRreMxOjuLHRemiexifk7pCkw2M3nJSttImF NRtaSEIRAcVktb7t1OSSlGTdju4N4v247YcgeFF01NLOIYZcuA8LwZWshpkZnwbIx7N5Ps SiBorR9MNEj8pn5y0Sj6wN8ORfqeMwc= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 488C664EA0; Thu, 18 May 2023 11:47:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F0B5C433D2; Thu, 18 May 2023 11:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684410466; bh=UoOYGsMGyMMEKJ1qkzNYsll/wCyWl/nZo9olULeimuI=; h=From:To:Cc:Subject:Date:From; b=MgJKr48az7m1maC+5bU+MGI4uP+7mBT3hWl30A7YcL+cgivlPF30VKLMqw7WSucXZ Ox9YMRyo7ZdDxP0wMLf5ic9Dzysu1/jc1NSpvMypEt5ctlHRJv0rQo7srSyKqF/gS7 SaGZkN5cJEev21H/T+NTGT9p7pZ3pT6aU3i8xlVw862fXe0G3SWCffI7T1I0/FddIn sdlL3ODMdHT5CY29cN6680mfspWWgnBAbIX/einbTQ6ldWOceymtiXAab0t9lVjCZM kJE4+R+7Xsu78Bg3MzPZG9hXx5zqPodwwI7h4m2fWSA4FBWsMxwj3GMWc45mudUi/c F1gHaCzCQQNrg== From: Jeff Layton To: Alexander Viro , Christian Brauner , "Darrick J. Wong" , Hugh Dickins , Andrew Morton , Dave Chinner , Chuck Lever Cc: Jan Kara , Amir Goldstein , David Howells , Neil Brown , Matthew Wilcox , Andreas Dilger , Theodore T'so , Chris Mason , Josef Bacik , David Sterba , Namjae Jeon , Steve French , Sergey Senozhatsky , Tom Talpey , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org Subject: [PATCH v4 0/9] fs: implement multigrain timestamps Date: Thu, 18 May 2023 07:47:33 -0400 Message-Id: <20230518114742.128950-1-jlayton@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: djihoorb7k8gf6bfaxf5bbgdthhjjf3b X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 695FC100009 X-HE-Tag: 1684410468-575357 X-HE-Meta: U2FsdGVkX18tcfs3AYVd7FdIYRnjsEn45X0LD12xKrJkErf6iq9zaeTDiTIPeczS3DI4LZWLXqff4Hsvq2yUCG+H2LgbUJcJ0sAQg9dAi9d23xBbTeuT8t62AXoOMMtRpeRiN/a2LDYypKWQpvFYaxpRQtOilRZbt6K2E50huRWAPiwDYUXPtK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CM3Zb28vRAsGaQ== 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: v4: - add request_mask argument to generic_fillattr - Drop current_ctime helper and just code functionality into current_time - rework i_ctime accessor functions A few weeks ago, during one of the discussions around i_version, Dave Chinner wrote this: "You've missed the part where I suggested lifting the "nfsd sampled i_version" state into an inode state flag rather than hiding it in the i_version field. At that point, we could optimise away the secondary ctime updates just like you are proposing we do with the i_version updates. Further, we could also use that state it to decide whether we need to use high resolution timestamps when recording ctime updates - if the nfsd has not sampled the ctime/i_version, we don't need high res timestamps to be recorded for ctime...." While I don't think we can practically optimize away ctime updates like we do with i_version, I do like the idea of using this scheme to indicate when we need to use a high-res timestamp. The basic idea here is to use an unused bit in the timespec64.tv_nsec field to act as a flag to indicate that the value was queried since the last time we updated it. If that flag is set when we go to update the timestamp, we'll clear it and grab a fine-grained ktime value for the update. The first couple of patches add the necessary infrastructure, and the last several patches update various filesystems to use it. For now, I'm focusing on widely-used, exportable filesystems, but this scheme is probably suitable for most filesystems in the kernel. Note that this does cause at least one test failure with LTP's statx06 test. I have submitted a patch to fix the issue (by changing how it fetches the "after" timestamp in that test). Jeff Layton (9): fs: pass the request_mask to generic_fillattr fs: add infrastructure for multigrain inode i_m/ctime overlayfs: allow it to handle multigrain timestamps nfsd: ensure we use ctime_peek to grab the inode->i_ctime ksmbd: use ctime_peek to grab the ctime out of the inode tmpfs: add support for multigrain timestamps xfs: switch to multigrain timestamps ext4: convert 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/delayed-inode.c | 2 +- fs/btrfs/inode.c | 4 +-- fs/btrfs/super.c | 5 +-- fs/btrfs/tree-log.c | 2 +- fs/ceph/inode.c | 2 +- fs/cifs/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 | 19 ++++++++-- 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 | 48 +++++++++++++++++++++---- fs/kernfs/inode.c | 2 +- fs/ksmbd/smb2pdu.c | 28 +++++++-------- fs/ksmbd/vfs.c | 3 +- fs/libfs.c | 4 +-- fs/minix/inode.c | 2 +- fs/nfs/inode.c | 2 +- fs/nfs/namespace.c | 3 +- fs/nfsd/nfsfh.c | 11 ++++-- fs/ntfs3/file.c | 2 +- fs/ocfs2/file.c | 2 +- fs/orangefs/inode.c | 2 +- fs/overlayfs/file.c | 7 ++-- fs/overlayfs/util.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/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_inode_buf.c | 2 +- fs/xfs/xfs_inode_item.c | 2 +- fs/xfs/xfs_iops.c | 4 +-- fs/xfs/xfs_super.c | 2 +- include/linux/fs.h | 68 +++++++++++++++++++++++++++++++++-- mm/shmem.c | 4 +-- 52 files changed, 260 insertions(+), 95 deletions(-)