From patchwork Fri Jul 5 17:02:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13725399 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 B4E59C3DA41 for ; Fri, 5 Jul 2024 17:03:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 490006B0092; Fri, 5 Jul 2024 13:03:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 43F526B0099; Fri, 5 Jul 2024 13:03:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E0136B009A; Fri, 5 Jul 2024 13:03:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0A9CB6B0092 for ; Fri, 5 Jul 2024 13:03:00 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B384012028F for ; Fri, 5 Jul 2024 17:02:59 +0000 (UTC) X-FDA: 82306318878.10.243B9CD Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id D62B6180016 for ; Fri, 5 Jul 2024 17:02:57 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NUWuxt9i; spf=pass (imf16.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=1720198965; 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=8hi8vVPeX1XTTSBGKtQF9jGkWcarcYmSwur1wDYaJSc=; b=GonXJ8KHH+bkWqPeRf3yTycO/mkTNgTejqcsxSpf8KbBrBxuPiW+RjbQ3VY3z5h2Ph2nlQ jyfsOLExiWmStbfIQlOaEWiCBueDmzhxM3XaWsAkxwUIAcBDyOUdrwxQAEEL1ZKO8DUrm3 xePrp8UwPpeZSwM8/aQBrAp94/jV/ns= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NUWuxt9i; spf=pass (imf16.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=1720198965; a=rsa-sha256; cv=none; b=RFdhmtCOz60gTB4SIQ8akfQhntEXXuOPQoj9RbP6azWrnJFSYLpKzliJW1wtb/eFKV2MGu YiYTlvb6vxgUGRU2RIVMPOiTvLef+8zSRN6eWd/xFqnUNYeUOV/OfiV2NalSfUfc3AZFd0 sVmlfYofiVy4U5JBpA/UOZHEnNqvAsE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id DC411627F5; Fri, 5 Jul 2024 17:02:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17399C4AF07; Fri, 5 Jul 2024 17:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720198976; bh=GpNXKixQKHwmxqdS5uwKxyyDRs6usVf9Q2aUQOt0m2o=; h=From:Subject:Date:To:Cc:From; b=NUWuxt9iDBBNGHC9VWuq8vAP00vsRGoenkOw+bUutWZBj2UTXEpqhsTChsry/mhpg Z02XCSWfog4QtTcv0Q6AxozBFJEK8ScwKtkkzmsmaxB4L7YP49J23dGvdYefJA1Ihr zAGoc38iMc2wlr9vs1qjmuBchHYPxTJPrp3upBm9tU7rOMLbXtd+LOfnAphO8xouXP 1DEdlo9IKw8wLtfaR9A22RfNSdHPw812VioB2tlx4npYiIbmvgqWirHHZ8sA+LiiWp yoFBbxNhqbQblB2kjtQ4BVht0NUC8U4Q9ZxejJMGx1Kce6vESZI5PG5On3wI1bpGHP 3sdzbbA4xtW/Q== From: Jeff Layton Subject: [PATCH v3 0/9] fs: multigrain timestamp redux Date: Fri, 05 Jul 2024 13:02:34 -0400 Message-Id: <20240705-mgtime-v3-0-85b2daa9b335@kernel.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAConiGYC/2WMyw6CMBBFf4XM2pqZ8rB15X8YF0gHaJRiWtJoC P9uYaExLs/NPWeGwN5ygGM2g+dogx1dgnyXQdPXrmNhTWKQKAusZCWGbrIDi7IxCq+kjCKEdH5 4bu1zC50viXsbptG/tm6kdf1LRBIoalI6L6XBVrWnG3vH9/3oO1gbUX69A9LHk8kjbQqStS7Q6 B9vWZY3HU29ZNUAAAA= To: Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chandan Babu R , "Darrick J. Wong" , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Jonathan Corbet Cc: Dave Chinner , Andi Kleen , Christoph Hellwig , kernel-team@fb.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-doc@vger.kernel.org, Jeff Layton X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5230; i=jlayton@kernel.org; h=from:subject:message-id; bh=GpNXKixQKHwmxqdS5uwKxyyDRs6usVf9Q2aUQOt0m2o=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBmiCc2mW3Ax9riCifJk81b/A4ti+wBSBpCt9fL3 kufw+dDdlaJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZognNgAKCRAADmhBGVaC FUh+EACt/ob9lB1os3d1+625J7Nr+v1FlGeUZzyHjLIes76oKNEAWNcMVKowKpFAe6zNQNXwENR fEcEzdNiWnnqQQZbvRHGkd/SsE0Xn4e9afNIkc1kg011Pp3KUs+fjvDckPpr39UJpCWCnu+QKcn P9kVXTwSibJyLdv4FoY9idGeGNRszUCDeMqzvkOFoJX+Kgo17JX44QntHwCjc45VAMmsZLW9nqI IT043ZapyyJYsADKoSBTJIDK/G0xaP1ZDpiJmnsHcCtMsK08fQmcy0pjLXdYUDTG5QRdm+gqEVe cxn99SJm2UEhpmOjA95QLHa978CrzlDOkBXjjEFplP4HiaNnkMfy8EfbzqUbdVZqA6fQngN9sHm veIf+I4gVAP/75ZF5De5rZRLaDBXIko9k7tcYw2QhedH+qI0nTY853QUVx/1go1CUhUScNT6FMw UXztQ7Wo4oBPzsmdDAjcgRwSOQ6kTFmJySQqRAgF/oA9lo/hYy44mVplqDVKQTc7H1XLJw0g5br I3sYFf7YxmsnHiWPFR0MNj4xThLU/XuhwChiSrYlGER+EOha5Z67I5bv+f6OXJLOoa4fY7nmMDY 1SKT9qN1kiHAr/SUVg5HZYJjAHCh2re9SnyeHE+CWJPm1CdV1Dv2vupgDxLQBVvtcDJEclDuBbY 9U9TnzERBZN5CAg== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: D62B6180016 X-Stat-Signature: 5hhmzhqg7sjfpcadxihadp3sdsndeofw X-HE-Tag: 1720198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0cZkV5W293Pk+gKn9i2kiJ4EHcU/SYD9jRZNd/UXMqBtHfDWroOEexcD93nfPHZ8Gg0Vt/Er3sUSl9D2Jd9cOxswNd4KnUHt/TTirX0plc7ma3tLiQTV6Rs26QpB15wyEZj7WDae9yeQTmpI1OuNBVpvGholSqxwIzbazZ4Yb/tbnbMQEWJeGW8QLmpIzKjYj2b+Jgx7YQ24UdleaGD5QOmOA5F8x+RNY3Dpqr83eXdagVp6MmvxCoxdLhcKEpsA9jU/x0a+k9ipWusnZtuDnJcGsj5X4nOxePaum0h9eNarm6ZJsgBHI1wGQtEDWA11KR8Gog5NcC8mQnqdXXzd+cEU6mZKXm/6J4IZa/zr31r1AqCSwR7H5BlcngnHcTzYHpPB9RPFD5v12+6lI4JptGoMzzbLzC3AeGWiMd+bcZi3zQ3IfB8LpXXJ4GBeEV3kVIF9rpMhwzQcL6GgSTMzClUd19fGzHJ4wuv6crJW5dUCzUBwVYgXob8O5LXYL4FYwX2yWJ6z7oKJhPLl2AOADg1rKJCITg1RnQmgchIVXzNaQRMlqLEutGiCHx+ThiEAZH7c509fotwppwRied5m2jS4DksR5iQMkLJ4JuwHTENFApom2E6HZlfKBgqzYN8GXy++rLMbwvWcSPPdjq4u5e/c555Bm6JXbVodLGOT2kpJAZ68Td0+uPE8/cBTOMl1JXGgMDj61GZNvLwTJn1hkAfJHzmEP5IhMn4CXgvaZqowYpM/KF2/bAI4iSq53dIE5+K7s3TDLFLGSVJsfsoPtZKA6zvIlSD6Weh8oUW6OJqmPU418HLJnizaz7mvxELzAMGYgOquFAAvh8/u6oHiUVC3moOiTPwisQ1+37XdoHequBWpX7O4LqqNpT24n8P33HUG7SsL OjJDA30V v6QcGGKiZcSy1X82s4GPCScHfzO9v4LP/h/pVM+ATGNt2yYPyrh4Bw== 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: List-Subscribe: List-Unsubscribe: tl;dr for those who have been following along: There are several changes in this version. The conversion of ctime to be a ktime_t value has been dropped, and we now use an unused bit in the nsec field as the QUERIED flag (like the earlier patchset did). The floor value is now tracked as a monotonic clock value, and is converted to a realtime value on an as-needed basis. This eliminates the problem of trying to detect when the realtime clock jumps backward. Longer patch description for those just joining in: At LSF/MM this year, we had a discussion about the inode change attribute. At the time I mentioned that I thought I could salvage the multigrain timestamp work that had to be reverted last year [1]. That version had to be reverted because it was possible for a file to get a coarse grained timestamp that appeared to be earlier than another file that had recently gotten a fine-grained stamp. This version corrects the problem by establishing a per-time_namespace ctime_floor value that should prevent this from occurring. In the above situation, the two files might end up with the same timestamp value, but they won't appear to have been modified in the wrong order. That problem was discovered by the test-stat-time gnulib test. Note that that test still fails on multigrain timestamps, but that's because its method of determining the minimum delay that will show a timestamp change will no longer work with multigrain timestamps. I have a patch to change the testcase to use a different method that is in the process of being merged. The testing I've done seems to show performance parity with multigrain timestamps enabled vs. disabled, but it's hard to rule this out regressing some workload. This set is based on top of Christian's vfs.misc branch (which has the earlier change to track inode timestamps as discrete integers). If there are no major objections, I'd like to let this soak in linux-next for a bit to see if any problems shake out. [1]: https://lore.kernel.org/linux-fsdevel/20230807-mgctime-v7-0-d1dec143a704@kernel.org/ To: Alexander Viro To: Christian Brauner To: Jan Kara To: Steven Rostedt To: Masami Hiramatsu To: Mathieu Desnoyers To: Chandan Babu R To: Darrick J. Wong To: Theodore Ts'o To: Andreas Dilger To: Chris Mason To: Josef Bacik To: David Sterba To: Hugh Dickins To: Andrew Morton To: Jonathan Corbet Cc: Dave Chinner Cc: Andi Kleen Cc: Christoph Hellwig Cc: kernel-team@fb.com Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-trace-kernel@vger.kernel.org Cc: linux-xfs@vger.kernel.org Cc: linux-ext4@vger.kernel.org Cc: linux-btrfs@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-nfs@vger.kernel.org Cc: linux-doc@vger.kernel.org Signed-off-by: Jeff Layton Changes in v3: - Drop the conversion of i_ctime fields to ktime_t, and use an unused bit of the i_ctime_nsec field as QUERIED flag. - Better tracepoints for tracking floor and ctime updates - Reworked percpu counters to be more useful - Track floor as monotonic value, which eliminates clock-jump problem Changes in v2: - Added Documentation file - Link to v1: https://lore.kernel.org/r/20240626-mgtime-v1-0-a189352d0f8f@kernel.org --- Jeff Layton (9): fs: add infrastructure for multigrain timestamps fs: tracepoints around multigrain timestamp events fs: add percpu counters to count fine vs. coarse timestamps fs: have setattr_copy handle multigrain timestamps appropriately Documentation: add a new file documenting multigrain timestamps xfs: switch to multigrain timestamps ext4: switch to multigrain timestamps btrfs: convert to multigrain timestamps tmpfs: add support for multigrain timestamps Documentation/filesystems/multigrain-ts.rst | 120 +++++++++++++++ fs/attr.c | 52 ++++++- fs/btrfs/file.c | 25 +--- fs/btrfs/super.c | 3 +- fs/ext4/super.c | 2 +- fs/inode.c | 224 ++++++++++++++++++++++++---- fs/stat.c | 39 ++++- fs/xfs/libxfs/xfs_trans_inode.c | 6 +- fs/xfs/xfs_iops.c | 10 +- fs/xfs/xfs_super.c | 2 +- include/linux/fs.h | 34 ++++- include/trace/events/timestamp.h | 109 ++++++++++++++ mm/shmem.c | 2 +- 13 files changed, 550 insertions(+), 78 deletions(-) --- base-commit: cc8223373449ecbd4c18932820714235db6006c4 change-id: 20240626-mgtime-5cd80b18d810 Best regards,