From patchwork Wed Oct 18 17:41:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13427576 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 37797CDB487 for ; Wed, 18 Oct 2023 17:41:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA6B68D0177; Wed, 18 Oct 2023 13:41:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B5FCC8D0016; Wed, 18 Oct 2023 13:41:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CFF28D0177; Wed, 18 Oct 2023 13:41:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 892B98D0016 for ; Wed, 18 Oct 2023 13:41:37 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4B810140445 for ; Wed, 18 Oct 2023 17:41:37 +0000 (UTC) X-FDA: 81359299434.16.918AE1A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 63FBD8000D for ; Wed, 18 Oct 2023 17:41:35 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=vHqr3PeT; spf=pass (imf02.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=1697650895; 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:in-reply-to:references:references:dkim-signature; bh=kTpF+NdChHFSpVpycDabsrC9jci3YAdosloac/EWD5M=; b=JxKxQKB7UZbhitbvC2I0Kv6svwVfcWPBK5p8+NuFbV5G4DJFYXrnXeRpPT89GM04sQKex2 6sigFVl8tXyJUNTzIWVfyQTQVhKOz+483mCym82JXF8QWq8YViXzD5b22k67Km86ObisF0 IqFe+z7TomyuybhAwL4OCE38tngzsuU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697650895; a=rsa-sha256; cv=none; b=IKuH3v4T0IjZQxFBx8lCfGe1qpm/MiZsNXYgEr9/GQ6Xy+0MoB9Xzhwx1YLda59DlfrsNA YgFrE7oYV9b3ojWCaazt596ZCvQWO2y2b3J1YXQCNICWAE+psaJX8B2eR2uoHQ6kkzFCqd 7TBj+Q/fojBB7rvzZpnIwU5FY273xyk= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=vHqr3PeT; spf=pass (imf02.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 (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 81686618AC; Wed, 18 Oct 2023 17:41:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0865C433CD; Wed, 18 Oct 2023 17:41:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697650894; bh=jWmZ1Ravl5cu/wOo4Bog6k1d+CwyPST2G6rAUV4ZYAc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=vHqr3PeTFpDRNPF3idVxxCdnb1iVi0NE8DkKoUZrVcZEfyflEgmWCoz3c30QBIYgV QHUjC6yzrdbgCryMrV/z8AraieOhCmp5ydSy1Jlqy/frfz3I7YSKlgI5kDCw9W9L0G 6wdcPzpynxo6jrP6c7EPrU4xUvOBBF8acqKT80+bwKIiWoG+0FKGZn2rspmzYEp5Uw yczqNkmwK3PiefZQP5RsLlEHZJRaSQCGu1OYDHgU58+Yl+kixzJq6GJmgUYJk5WB9q jGypQFbK++CbII2WD5VXoDWHRSnbQ9wKs9T6uoUfg0c1QygVUa4DSDyJFGF5QUtR0X akQ1ufOzxnSZQ== From: Jeff Layton Date: Wed, 18 Oct 2023 13:41:08 -0400 Subject: [PATCH RFC 1/9] fs: switch timespec64 fields in inode to discrete integers MIME-Version: 1.0 Message-Id: <20231018-mgtime-v1-1-4a7a97b1f482@kernel.org> References: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> In-Reply-To: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> To: Linus Torvalds , Alexander Viro , Christian Brauner , John Stultz , Thomas Gleixner , Stephen Boyd , Chandan Babu R , "Darrick J. Wong" , Dave Chinner , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Amir Goldstein , Jan Kara , David Howells Cc: linux-fsdevel@vger.kernel.org, linux-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, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4674; i=jlayton@kernel.org; h=from:subject:message-id; bh=jWmZ1Ravl5cu/wOo4Bog6k1d+CwyPST2G6rAUV4ZYAc=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlMBjIMZMk9hA0a0rbXtgzOBS8+JUCWebR2P/8J wgnb+onjoOJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZTAYyAAKCRAADmhBGVaC FRN4D/4hg/46V/lM9F5UuttDEfFBixG4KR0EymQEurGFApb4lySZ+KxbxVkqAm7IyL+FGAaylWc HWdk3vSQOpB0wg/2wS4ymKQcXH85SVmR/9XEb7cwkGmGji5l1IRuyksbprbUJUoYrd74o3VwZ2J FGfFODjJ1z2g8QOi+FPBhSrHSMPe6a+6t1RhTll6jSfUaLC5mT72UQKVTqezrCk3c7BrDg7wF8W P3sKppsD3IboBFnqLbTs+9FMukgmOdVC5ot278zCccIfSVSTWJov4PuYGZGg2sxnKJHL00sXNzC UpTPwBA06FEZnVVSubHR+v91WVQ9P8C7VgWnpAkNm0CuuoNGtBmtvA7dEM95ePdvysiYdTNgfbL lw9ll9YwoDxfKsgg8rC6dm6qHAEDZ4d2yBpi2ytPeV6cosMnf7ABN6v1L7saN4C9DAj43QdvZ0L NI9Sf0xSeBKtgKlsAkaKw1vFv9SxFWOvRLr06pyTa7aogQymJeKR714W1uy52Hb7lXCTSQGiDqt LBOBs244/a4JkQg0YfaivbgWS4haeHjH/Tc/YCT7wc6YGa+dUSQIviYyiczEXqT1Xvim3WEL+vK QXaNIVewLajwOQrViIMfh0wl3NievUibTIxrqaKsoZH9/zvSBivCwxyjO+SU5bOzzJvjm6OM1Zz MO1qldTLt22SnAw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: 63FBD8000D X-Rspam-User: X-Stat-Signature: uumntc3oc1pif6hs3jjgxf6m83oe5qd6 X-Rspamd-Server: rspam03 X-HE-Tag: 1697650895-10740 X-HE-Meta: U2FsdGVkX1/EB8Hg6t0vC99m633LgHWJkjdOeXycMeK7LDq+XcbvZWT2jqCybWavioFCLXTmER7CTrYZThjLh62UsOco8FIdTTTYev5icq/ynIVFUfZJPZLH3e1y3qLmQpVDgRcQ+yZp4pnzAdcFUWykFaNr8lX33pukbBlU4GQMg35vDbo5fYfS61BIW3saTMZfyI4+UOSykvCpTXeRP97Ee3FHudjKutIEnG5ktIOOGxJC9FtEpetbnS9qv9L+HuTmtDEb2rBYgHAKBOe3nszHL24HbjY+l+eXCz7KD7sJfOnoo29f9POzW09TCVkmYvzWNhdlHQwo77IfhIc1+dG2RcpKVIHXzzfpS1kCCqBtT2tncDWA/U6PO5ibzzhY7veTyN1Ch+buh1UNsIBsyrpyipG2KEJfM2KUoESFZljxuH47Lvv/bB0jbsAYJCkBhhvc1VklZweEGUHPNyAZCIHUxUNd6munpjGwOb1tPF7wm5qNLdyeUaYhrC4F+91qY6aRfb47TAhbVh0TQ4uYKYsrMpqxfvZ9bqM8DxXNUryd+r+5puMY9uJM9V1z6F+tNx36Gc1g1pn9OAcc7hzCpVomt11Gl8p0ppYKk8umSj2/ROtybfElyvlv5jlw3jK2xwLmQMJh5IHVGHNL0yUWpzs5YQk5pRroL2YS6evaD1r5uisPxCFZyVaZGwywjaZ6XWgmeVZB6xvaFkdKFbAhUcUguIP61isgzKBQTvs1JAGHrg2S623M0UyquBLO+W4aWU6pXFos3pd9K3O3wUogI3JA7v9QIyLVDeaBIVQYVpr4FowIiM9BN3qpuKDv0jAaN45D1YKQRc3Zg8jxwZdhPMfGYWvekLEazSZUc7CiN3afxL2Sp1ZzMQiBl8b+vvSQw18CipqAd9CZeRcCbX63TkMTxzZmovQ2bfWKYYgM2XnVXKJDUZTPlLfn+5oHDVV/HT/EHEUcjOG/Rqf85/T KqQ5iSN8 aTVzK5sqZIrHi5wiUrk1SSYqXhH3L8GrWBUVZiTVIb7NqFanieiKiV5UnO0yVVh52V7mJKyx9N2kCdrLgKesdjAs4lFVPMiWRqDQfvikrAS75Aj7jkA2KEHqltkf0KXqZvcdQmSMNU7tln/i8rm2PENJj68CvUiY6D4uBn7xtQ4Pk38zGla+n2pzKwAOHiQoiY7cRSqi/j3Dx+wXL9N4H9hBEGxvz4PQe/IMMgWXlGkdn10zM8hRH3sBzUGfeaRfDko7KCn1LPRUVTikrfH5eLWa30rPxcpX0C4qtTBple/PneurS8moQ83GlAomuUwRbcFYJzRRuN9lFJiQ= 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: This shaves 8 bytes off struct inode with a garden-variety Fedora Kconfig, but it moves the i_lock into the previous cacheline, away from the fields it protects. To remedy that, move the i_generation just after the nanosecond fields, which moves the 4 byte hole down next to i_fsnotify_mask. Suggested-by: Linus Torvalds Suggested-by: Amir Goldstein Signed-off-by: Jeff Layton --- include/linux/fs.h | 56 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index cc29518517f7..78786c1c32fd 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -671,9 +671,13 @@ struct inode { }; dev_t i_rdev; loff_t i_size; - struct timespec64 __i_atime; - struct timespec64 __i_mtime; - struct timespec64 __i_ctime; /* use inode_*_ctime accessors! */ + time64_t i_atime_sec; + time64_t i_mtime_sec; + time64_t i_ctime_sec; + u32 i_atime_nsec; + u32 i_mtime_nsec; + u32 i_ctime_nsec; + u32 i_generation; spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ unsigned short i_bytes; u8 i_blkbits; @@ -730,10 +734,10 @@ struct inode { unsigned i_dir_seq; }; - __u32 i_generation; #ifdef CONFIG_FSNOTIFY __u32 i_fsnotify_mask; /* all events this inode cares about */ + /* 32bit hole reserved for expanding i_fsnotify_mask to 64bit */ struct fsnotify_mark_connector __rcu *i_fsnotify_marks; #endif @@ -1513,23 +1517,27 @@ struct timespec64 inode_set_ctime_current(struct inode *inode); static inline time64_t inode_get_atime_sec(const struct inode *inode) { - return inode->__i_atime.tv_sec; + return inode->i_atime_sec; } static inline long inode_get_atime_nsec(const struct inode *inode) { - return inode->__i_atime.tv_nsec; + return inode->i_atime_nsec; } static inline struct timespec64 inode_get_atime(const struct inode *inode) { - return inode->__i_atime; + struct timespec64 ts = { .tv_sec = inode_get_atime_sec(inode), + .tv_nsec = inode_get_atime_nsec(inode) }; + + return ts; } static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode, struct timespec64 ts) { - inode->__i_atime = ts; + inode->i_atime_sec = ts.tv_sec; + inode->i_atime_nsec = ts.tv_nsec; return ts; } @@ -1538,28 +1546,32 @@ static inline struct timespec64 inode_set_atime(struct inode *inode, { struct timespec64 ts = { .tv_sec = sec, .tv_nsec = nsec }; + return inode_set_atime_to_ts(inode, ts); } static inline time64_t inode_get_mtime_sec(const struct inode *inode) { - return inode->__i_mtime.tv_sec; + return inode->i_mtime_sec; } static inline long inode_get_mtime_nsec(const struct inode *inode) { - return inode->__i_mtime.tv_nsec; + return inode->i_mtime_nsec; } static inline struct timespec64 inode_get_mtime(const struct inode *inode) { - return inode->__i_mtime; + struct timespec64 ts = { .tv_sec = inode_get_mtime_sec(inode), + .tv_nsec = inode_get_mtime_nsec(inode) }; + return ts; } static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode, struct timespec64 ts) { - inode->__i_mtime = ts; + inode->i_mtime_sec = ts.tv_sec; + inode->i_mtime_nsec = ts.tv_nsec; return ts; } @@ -1573,34 +1585,30 @@ static inline struct timespec64 inode_set_mtime(struct inode *inode, static inline time64_t inode_get_ctime_sec(const struct inode *inode) { - return inode->__i_ctime.tv_sec; + return inode->i_ctime_sec; } static inline long inode_get_ctime_nsec(const struct inode *inode) { - return inode->__i_ctime.tv_nsec; + return inode->i_ctime_nsec; } static inline struct timespec64 inode_get_ctime(const struct inode *inode) { - return inode->__i_ctime; + struct timespec64 ts = { .tv_sec = inode_get_ctime_sec(inode), + .tv_nsec = inode_get_ctime_nsec(inode) }; + + return ts; } static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode, struct timespec64 ts) { - inode->__i_ctime = ts; + inode->i_ctime_sec = ts.tv_sec; + inode->i_ctime_nsec = ts.tv_nsec; return ts; } -/** - * inode_set_ctime - set the ctime in the inode - * @inode: inode in which to set the ctime - * @sec: tv_sec value to set - * @nsec: tv_nsec value to set - * - * Set the ctime in @inode to { @sec, @nsec } - */ static inline struct timespec64 inode_set_ctime(struct inode *inode, time64_t sec, long nsec) { From patchwork Wed Oct 18 17:41:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13427578 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 D19BACDB483 for ; Wed, 18 Oct 2023 17:41:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DAD38D0179; Wed, 18 Oct 2023 13:41:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58DC08D0016; Wed, 18 Oct 2023 13:41:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B5F38D0179; Wed, 18 Oct 2023 13:41:44 -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 283CC8D0016 for ; Wed, 18 Oct 2023 13:41:44 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 006BE40411 for ; Wed, 18 Oct 2023 17:41:43 +0000 (UTC) X-FDA: 81359299728.11.FFC01CD Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf05.hostedemail.com (Postfix) with ESMTP id 7E372100010 for ; Wed, 18 Oct 2023 17:41:41 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LUqQBlq5; spf=pass (imf05.hostedemail.com: domain of jlayton@kernel.org designates 145.40.73.55 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=1697650902; 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:in-reply-to:references:references:dkim-signature; bh=D+VwaeTo/eajohWlryeUF2HdkxnTLV2ePXnC8ux0Ge4=; b=s+I+ZVd6e7sBjK0ry83SDgZkK/GFsvAq0letmCKGvPOMgzOCjCFVzF1gqoD+cgKIhDLk+N gv0kKWFtwPuvxJMR0SIXVpZs/evDarevurNbgeKnxfAh9lQTwBgih8+pM4Xh1lzayE2oIc YXb1kLdWnjLvki5ttCwOqSObfJUiiA4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697650902; a=rsa-sha256; cv=none; b=w2sbpgX5kynKEqbYuI9wF+DxPEJKxUlsX82jYjG2h79Xf0dKXG+vg/4tk7a2zS18GpQRhF XvmNRjB+ubYZ7TQZ7MyufikQJ0HnM3uFtdkHnzoBUKS6tr2nqDQu79bly6tzAtlm7Tekxg 46LPpMAcJilQ2JqM+YZfx3GWmD7rz7k= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LUqQBlq5; spf=pass (imf05.hostedemail.com: domain of jlayton@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 6A4A4CE2656; Wed, 18 Oct 2023 17:41:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BDD8C433C9; Wed, 18 Oct 2023 17:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697650896; bh=l0xHAIUUN2BOMaLZLaXQNle/CdEVUPvjoRJwRfogB3k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LUqQBlq5SbTTxc8Kx4I5i/jnPXcg/nEx9UsQqT9B+eDje7FSiAkGbhYGwQRlQFBq5 qVEbFGoYB6HtCUqP3zUIt+ld6j6Qti0Vb6h7iw3F8f44xPv78xT8mBKrr/YGDlufQ9 tndvU4bWohBgShTn/iB4jplkLEklhbyiqF8FTwc8sM4T1UzsplSeCJur567WQZbXkF F3VaIwe+XEc1jHV5/4BFZD6UVt0Ts9otCsK7RVipp0nXKmd8N0NrfkdWxQulPKu5wY MC9cv5D2gqFsKKlnLdO+j02QzxS5+ftCkhlMxWxW+z9Nwcgi51mkMCUSSoD22g8q1W bjWwbHPGI2/yg== From: Jeff Layton Date: Wed, 18 Oct 2023 13:41:09 -0400 Subject: [PATCH RFC 2/9] timekeeping: new interfaces for multigrain timestamp handing MIME-Version: 1.0 Message-Id: <20231018-mgtime-v1-2-4a7a97b1f482@kernel.org> References: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> In-Reply-To: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> To: Linus Torvalds , Alexander Viro , Christian Brauner , John Stultz , Thomas Gleixner , Stephen Boyd , Chandan Babu R , "Darrick J. Wong" , Dave Chinner , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Amir Goldstein , Jan Kara , David Howells Cc: linux-fsdevel@vger.kernel.org, linux-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, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6981; i=jlayton@kernel.org; h=from:subject:message-id; bh=l0xHAIUUN2BOMaLZLaXQNle/CdEVUPvjoRJwRfogB3k=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlMBjI+0b0/ffAFY3zqBSBgVUVHdNbNXYnmuLk7 4JnuUitV2OJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZTAYyAAKCRAADmhBGVaC FQx3EACBnusFhJaHiDBDntSYskmOtKC9J0xUZA3qU6cq1/bt0CXSpLwV13odEIY6OqqXNUiFOeg zPsedjKHT90OgQ9De85Z2zj3ZP2Ne5Pl1IT58xW7uMWIdkIJpJ0CQAO6Ah2MYsDGPZgWIVN5ehL C2FXIHhVCvw0ZpRu96Vcou1wkA+eZuY1ODNnY1Y2It1eKv8HXIeCa6GKqz1YABH/YWpPrF2K4FD FHvvrN04Me65L/xgLUZWs/c9IuR+IkZrM3vzaUBRr2X+JYyj0EsyCiXnStSs5vSeDaJXWdceykW 9td0tzdxB7Q4yGflpOYRwR+awAiWHytZ0pBmzjS/KO33Z8GCtb4Lmt8sIQDddhjn6sPSiO4+CdT pNxkoE9t1KfhEo9ekAhh4WmOcx4HoES1scAKLKN9boy8Ycb+5zSVRj7kVyO3htCXW+4wKBWtRCW tWuN5BDRlluKCBx+7/SVs7BgZOm2FVaN/8mdYyMr3ysA/3zjaUy3yMdsl0WtJirPH6tiByo5VpS 9/68nBxm1oKiI1czGW4mWPuYXe1KWsPLLPKl/c60N/UK2KykHaxDCJIyLh6VSthY/pULGM4XwXq 2JZAYsJOXw/W6f4tmwd1vQ0f2q4ue8FZJV9TLHDbpUUxncalFo2hfgqU5SCX2MttvcncAi33zDG rifmicacYuiP+yg== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: 7E372100010 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 3ozyphec5jyha6ye5gni4bhk1649kpx6 X-HE-Tag: 1697650901-675258 X-HE-Meta: U2FsdGVkX18Dd0NXQOh4yG9bHfHqYpjXgMlacqLBxmdd48FYRmt0oCHUGZkouRpMsv/wLQefgBgwyxuDPXmE5thUaiUns0LKOpuedPStfH/1DBO/8JZ8gEtz1W/n2ikx44FsbAGqxeS3exwlhvvfEUKMLhwfhzDneDzcRpPFcCsQN1VOxVuBXlvbKW4K/iJjLv2TS/JKm3jWCxEzWb5DCMenw+YRj9H7hUXcuC5lrF4CAyqvSb3Gnlu+wDgq9LXED6wkbxCMOydRH96YIbjFFiJu52YqkpMP09zWkFljL9OO7N5sECorqK3WuD3XHVFogcp9NFXehMznn0Bbng33XAOJHFds221OUkiJEfDgvbkj2AfX26V7b5VkTXhrC40ovpsq1B4vMPFD7hyqB2YvANBFy/OCpm+hJqFyhrCnW2VEyKmHJG/+Eb+vPjrcIKZJYbXbqQi+q4VOs9U+BmGQ7NgLmT/qfL2BVwwyZzizHGMeMEWlaLKAULsopmFbqU2FDJyfPQExonpXAet5kP+oZ2XGy+Kjc1WH80xBnq3byXZE462HDIkuRGZNBD6MLpl8wte+I477xyXdOwkeTHSTKk8QiqFfRg7Kn59M2tFkMUyy+Zg1WddR9Wap88DEMdaxapakjjwOQoyCuCMewxtpSeUZEKQoUTzicYEDPauA8zg4yWEFYFy3x3faSnI7AD+JzofhL2DcJpT9l2xaDCDXLGlxkGT+zURevl/+NJPAkxal40dVUpGxfkcEkFVm/X90PYqpTEGEFf84ylPN+2ho45UPA7VPPOiGCIvws2G9FF0KrEIRu6oLD2rm/tk2stSJ6nA0Wdgv+4gFqsG38ucQMvqfS6gSqRRto/R9Ki+eWkIhCmFBvjpzSkXAJE4Wvey38xtzJxK7yyIxptgm865ZUrZUUUgPp0WnG/USDI9PjnTFJWluXCo5DaueNB6oWbUTusit8XbiMrdi75pPLEe 4CBhCFpT JQ2WxBmmMHXg8G50pEG8ckntTwM9mA/yrZdGJKtJ6RFKm5/j8u3UyGm9kl7iZPk5Lqy8MnZJ0OYwyhtAxRxKP2YI3Owgj6mW7PvvUc771inDPcvMUjQeMw3aOCJhsDvtSOzhiyC2jGRylMfZY22A7A+DIXhgE5rK41srlUIV3E+ngUlgiK7uceei9a2vQ3Ttipf47htNAvvCIz1U1xyaMF1qVIW+RSv6GU2/IXxLssyKF2GBjhR7g6oSzIA== 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: Multigrain timestamps allow VFS to request fine-grained timestamps when there has been recent interest in the file's attributes. Unfortunately, the coarse-grained timestamps can lag the fine-grained ones. A file stamped with a coarse-grained timestamp after one with a fine-grained one can appear to have been modified in reverse order. This is problematic for programs like "make" or "rsync" which depend on being able to compare timestamps between two different inodes. One way to prevent this is to ensure that when we stamp a file with a fine-grained timestamp, that we use that value to establish a floor for any later timestamp update. Add a new mg_nsec field to the timekeeper structure for tracking the nsec value of the most recent multigrain timestamp, along with two new helper functions for fetching coarse and fine grained timestamps. When getting a fine-grained timestamp update the mg_nsec with the value that was fetched via timekeeping_get_ns. When fetching a coarse-grained timestamp, set the mg_nsec to TK_MG_NSEC_IGNORE. When fetching a coarse-grained time for a multigrain timestamp, apply the mg_nsec value if it's not set to TK_MG_NSEC_IGNORE. Signed-off-by: Jeff Layton --- include/linux/timekeeper_internal.h | 2 + include/linux/timekeeping.h | 4 ++ kernel/time/timekeeping.c | 80 +++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h index 84ff2844df2a..6583b06e7d08 100644 --- a/include/linux/timekeeper_internal.h +++ b/include/linux/timekeeper_internal.h @@ -55,6 +55,7 @@ struct tk_read_base { * @tai_offset: The current UTC to TAI offset in seconds * @clock_was_set_seq: The sequence number of clock was set events * @cs_was_changed_seq: The sequence number of clocksource change events + * @mg_nsec: Nanosecond delta for multigrain timestamps * @next_leap_ktime: CLOCK_MONOTONIC time value of a pending leap-second * @raw_sec: CLOCK_MONOTONIC_RAW time in seconds * @monotonic_to_boot: CLOCK_MONOTONIC to CLOCK_BOOTTIME offset @@ -110,6 +111,7 @@ struct timekeeper { u64 xtime_interval; s64 xtime_remainder; u64 raw_interval; + u64 mg_nsec; /* The ntp_tick_length() value currently being used. * This cached copy ensures we consistently apply the tick * length for an entire tick, as ntp_tick_length may change diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index fe1e467ba046..5dc0ad619d42 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -44,6 +44,10 @@ extern void ktime_get_real_ts64(struct timespec64 *tv); extern void ktime_get_coarse_ts64(struct timespec64 *ts); extern void ktime_get_coarse_real_ts64(struct timespec64 *ts); +/* multigrain timestamp support */ +void ktime_get_mg_fine_ts64(struct timespec64 *ts); +void ktime_get_mg_coarse_ts64(struct timespec64 *ts); + void getboottime64(struct timespec64 *ts); /* diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 266d02809dbb..7c20c98b1ea8 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -33,6 +33,9 @@ #define TK_MIRROR (1 << 1) #define TK_CLOCK_WAS_SET (1 << 2) +/* When mg_nsec is set to this, ignore it */ +#define TK_MG_NSEC_IGNORE (~(0ULL)) + enum timekeeping_adv_mode { /* Update timekeeper when a tick has passed */ TK_ADV_TICK, @@ -139,6 +142,7 @@ static void tk_set_xtime(struct timekeeper *tk, const struct timespec64 *ts) { tk->xtime_sec = ts->tv_sec; tk->tkr_mono.xtime_nsec = (u64)ts->tv_nsec << tk->tkr_mono.shift; + tk->mg_nsec = TK_MG_NSEC_IGNORE; } static void tk_xtime_add(struct timekeeper *tk, const struct timespec64 *ts) @@ -146,6 +150,7 @@ static void tk_xtime_add(struct timekeeper *tk, const struct timespec64 *ts) tk->xtime_sec += ts->tv_sec; tk->tkr_mono.xtime_nsec += (u64)ts->tv_nsec << tk->tkr_mono.shift; tk_normalize_xtime(tk); + tk->mg_nsec = TK_MG_NSEC_IGNORE; } static void tk_set_wall_to_mono(struct timekeeper *tk, struct timespec64 wtm) @@ -1664,6 +1669,7 @@ void __init timekeeping_init(void) tk_setup_internals(tk, clock); tk_set_xtime(tk, &wall_time); + tk->mg_nsec = TK_MG_NSEC_IGNORE; tk->raw_sec = 0; tk_set_wall_to_mono(tk, wall_to_mono); @@ -2283,6 +2289,80 @@ void ktime_get_coarse_ts64(struct timespec64 *ts) } EXPORT_SYMBOL(ktime_get_coarse_ts64); +/** + * ktime_get_mg_fine_ts64 - Returns a fine-grained time of day in a timespec64 + * @ts: pointer to the timespec64 to be set + * + * Multigrain filesystems use a scheme where they use coarse-grained + * timestamps most of the time, but will use a fine-grained timestamp + * if the previous timestamp was queried and the coarse-grained clock + * hasn't ticked yet. + * + * For this case, the caller is requesting a fine-grained timestamp, + * so we must update the sliding mg_nsec value before returning it. This + * ensures that any coarse-grained timestamp updates that occur after + * this won't appear to have occurred before. + * + * Fills in @ts with the current fine-grained time of day, suitable for + * a file timestamp. + */ +void ktime_get_mg_fine_ts64(struct timespec64 *ts) +{ + struct timekeeper *tk = &tk_core.timekeeper; + unsigned long flags; + u32 nsecs; + + WARN_ON(timekeeping_suspended); + + raw_spin_lock_irqsave(&timekeeper_lock, flags); + write_seqcount_begin(&tk_core.seq); + + ts->tv_sec = tk->xtime_sec; + nsecs = timekeeping_get_ns(&tk->tkr_mono); + tk->mg_nsec = nsecs; + + write_seqcount_end(&tk_core.seq); + raw_spin_unlock_irqrestore(&timekeeper_lock, flags); + + ts->tv_nsec = 0; + timespec64_add_ns(ts, nsecs); +} + +/** + * ktime_get_mg_coarse_ts64 - Returns a coarse-grained time of day in a timespec64 + * @ts: pointer to the timespec64 to be set + * + * Multigrain filesystems use a scheme where they use coarse-grained + * timestamps most of the time, but will use a fine-grained timestamp + * if the previous timestamp was queried and the coarse-grained clock + * hasn't ticked yet. + * + * For this case, the caller is requesting a coarse-grained timestamp, + * which will always be equal to or later than the latest fine-grained + * timestamp that has been handed out. + * + * Fills in @ts with the current coarse-grained time of day, suitable + * for a file timestamp. + */ +void ktime_get_mg_coarse_ts64(struct timespec64 *ts) +{ + struct timekeeper *tk = &tk_core.timekeeper; + unsigned int seq; + u64 nsec; + + do { + seq = read_seqcount_begin(&tk_core.seq); + + *ts = tk_xtime(tk); + nsec = tk->mg_nsec; + } while (read_seqcount_retry(&tk_core.seq, seq)); + + if (nsec != TK_MG_NSEC_IGNORE) { + ts->tv_nsec = 0; + timespec64_add_ns(ts, nsec); + } +} + /* * Must hold jiffies_lock */ From patchwork Wed Oct 18 17:41:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13427577 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 E9D1CCDB47E for ; Wed, 18 Oct 2023 17:41:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D6C08D0178; Wed, 18 Oct 2023 13:41:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 785588D0016; Wed, 18 Oct 2023 13:41:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 625AF8D0178; Wed, 18 Oct 2023 13:41:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4C4528D0016 for ; Wed, 18 Oct 2023 13:41:42 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 130D31A03EE for ; Wed, 18 Oct 2023 17:41:42 +0000 (UTC) X-FDA: 81359299644.02.DD0B380 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id 421F580010 for ; Wed, 18 Oct 2023 17:41:40 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GcpsqU3P; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.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=1697650900; 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:in-reply-to:references:references:dkim-signature; bh=GwidXsdVI70LROKQV78+/AtnjaNX0OCUTFQHQNNMJNo=; b=KSFbWnTID7WBOL/q6GOCXhdSgZqKc7YfrzlyZnr47yRW3geD/MhSvvk+rozR73rMDiz2CX sUGKQPfmY1Hg78xWff5pNQkn/HJZdDxT62QxhgjTAlkB7oNIMthX+CNqaahema/QyDpRFl HeHbDzv9SHH/N9xhuo6vjIqzIA8QM/Q= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GcpsqU3P; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.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=1697650900; a=rsa-sha256; cv=none; b=HXP5VLHU3yf/p9RCYuXk4VPeR3kh7Re39zpCNTewhapazBzcZwQWI5bsrQ3n5mztt14DLL TrGPtBSiMjyDzOp8mgIfD6H3kyqSk2aDaPBww7N2lmvNUXDcSVCbWyvXWRn3WOmYjJRBmL hhlygLE2wLtThFb+I+3SVHtt3/CVujM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 711DC618B4; Wed, 18 Oct 2023 17:41:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1BBFC433D9; Wed, 18 Oct 2023 17:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697650899; bh=oV0lFdI7Yn7QJ5JE87c+C5HW+Uto4gEIDr/OnGVhofo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GcpsqU3PkpNElzrRNZAh3XTjk9L9FU1ZFKJ0Nuy36O4dTnIGzGvLmzqNHSEPu56yj fwpfkupeILBixno66h7UwaC+ESWCL5Mn9+PHSEDIe/d39R2QJtMWQdIk9dtKO+8mBv fs9yJoR0RLy47E5axLbnbDIwRRY/K92Ahi/zp/JiYqTrHQqZBsRgMsLEMiI58WmFY7 CPOULDJXAtNvZY2Y4tUNSA5fdezHHf+X+L8uPAgCasaFp2dpwPzXlw41p5JMyEMgSF V8IDjIp+cpdNbLf2y+84w2Z35QTu7OAnQl+JskaMxc+mKp7GxaRqPDtAUViX1j0jwi 1qYxkdVgrYioQ== From: Jeff Layton Date: Wed, 18 Oct 2023 13:41:10 -0400 Subject: [PATCH RFC 3/9] timekeeping: add new debugfs file to count multigrain timestamps MIME-Version: 1.0 Message-Id: <20231018-mgtime-v1-3-4a7a97b1f482@kernel.org> References: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> In-Reply-To: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> To: Linus Torvalds , Alexander Viro , Christian Brauner , John Stultz , Thomas Gleixner , Stephen Boyd , Chandan Babu R , "Darrick J. Wong" , Dave Chinner , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Amir Goldstein , Jan Kara , David Howells Cc: linux-fsdevel@vger.kernel.org, linux-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, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2249; i=jlayton@kernel.org; h=from:subject:message-id; bh=oV0lFdI7Yn7QJ5JE87c+C5HW+Uto4gEIDr/OnGVhofo=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlMBjIZJAEh2EvSWsTRIXNUoSp+/gPrdnrW38DM 8NdE4JkFmWJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZTAYyAAKCRAADmhBGVaC FYbiD/0ZFfWVcuSGUPgSgemJY2MzGuMffXnd/jkl+/NHQ1nlRsWS01DWyVwdWucUQasEC1H0rdI 5uXOT2GcTX/68+GO+2tqvb1JlhSnujcLZm1Lg456xiDlllxlwIhZ9tZrlYVCOrYuP8jEqXYvjZU V+pX3XjE/kpytbDpv4jBNXvd33alsrO1+bznAl0pM2sOm/dVXZQSQ8NYrpztvxjJk5qNLqUPS7Z U77qUZBIXUm2mQR8NpLwL471ld2/NmDB4pWDRjvCl9+E9LUaKW68g5iDdMrP1FYZEgo5nuBug26 G9gk1+WG8MzsHsYFl6ELLbS2zBVqoMtrdqt568EogG7jT0bV9ZMQdIYySUOXW4QYfw8xmG5gMep x76CG8p1DUeFingRztj1TLljnTJOBjvvu6/y4uHysrrk48R5ZJgW10j9GNfzFxlmWLjzROb5uq1 DrLstWJYcyyzYThiFx6ceWhtadCHD8oOozKVH0QwA2Iz6TUjCXq4wmT/TUthsNQ64iTwZKIscuS i8Te9fkr7v+sjrBd7L3KROqoW+H82LEsMIQaJGP7fXOLTpmGndcbF9RRWYs3TY48ha1YUBvq1tG mr5XAlH/ldtbzv9DCdGsn+zCmXwMuFoPEEiGSzhQzKBi1Xi62s7eCGftf2cmFcAvZBqTr8ByLyl avNZl9vDKp3Z4KQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 421F580010 X-Stat-Signature: qp7z8c8csg7khx1sa13rnkxx1s7gj5xs X-HE-Tag: 1697650900-47113 X-HE-Meta: U2FsdGVkX1/HladBBFDVNl6avAlNEoo47s0JFEqYZGrpYQcjjZBwfro/YGKkx4j9Ywh1sRX7QzTpSLNhl+A4B3m25oUhLOFc81Dfr9iooDjiF91K/ZmtBeQUYrK/F/zJKegjZvtzIvXI1+YC0PUNlFadOyU3qhwLfxErp0lwqLeHgBOP86NfrP0qHIwqSTZep/bAznX5OMFhnpuLyg3bRSDFfzTAk72U7FOMjRdJqqJ2HBAuetPi/xYzafqy97HdOfdImCUbCigUS4RLAGLzaPIvOtRlqt1W6aLaDOZEvJy0FbzWJxDFPpYDbZOtFMLdtiJaG6DwcCZHxZzTKQQzH18hzNIvUZW4hN1ugGGJsDvr+zPYXoMQ3ftxojOVw7KSPyt6NAsOJS+jyRMksyBoPhCiZ5xL3nWP+zIMY5MMHHLyH3oXxf/Kx7+aF71adhD/UF64CmzOpwy8BxH+OicZjPt2wTx9eRll9V6NhJSkxlIm4UFsF+NqX2Pp8PSyp0jkJv5/K9u3CjmF9ZDRYtqj72lsHst0f6C+OvIG8v1U6Sc8B5jE0G/QP9OTftHwVo8cP99lBSpQxzwF6WLajmV57ZHOXTOrugpYY8tzSvCBmPSbB0YY3UpsvDF8Z3d9pA9rAgE4uvBcBsYLxWifmuiypBkmfoYxE03gpDbCJUuDJsYnZRliOXiCqyclnM7Jp3qjcNVgwmLFce/XXWehcAHKHFbt8gVggpG0vqp+Q6kyC+R69UKDkijYneNTbojOKBJEjHFVjtmtXSQ1C+zD5YcJ8+pjN88c5FqMW65dcfk3uyxwJ5RIlADLRxijDJq4bRVprM+Htk+13PMH7YzSKzxBCoMFk3xdmKOv5OsQfBZG82YdLOMcYoz+igiKoc22azcKGLLkibo+iY4ZE9BPUw8NKkKqsHSAOa636VaXElI4tRxjb5cNKMARAaHezEddr/pmo6qvxp8y3nGlsfWZj3y yruekY1j vuhuXuOLbF83TiXMWEr/toKvNadl0neW1MFwXc0H1E1oxnOlCMDXbgJHfZ6dFQhCDjWRlt77yCkIvhL0WXDXNrd4aZPdgt4E8f9dsGPSy9jwVUgk1fSMk+mqHkjJhtJbsCptNhaxgnd2x/yH7qZBITOuGKOBrb+0MKRD/uUCe/d5nqOEHUZQH6Lvoi7SLhzr45F8VvkjUE+23LshEtFww1P06S3WO7lPGSxMAUaRNPIAb3w9rq8lDtDJWwaHc3+O4445hxSLQO9uIzOjt8Edl6l02S0A7XVaIunjS 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: Add two percpu counters for tracking multigrain timestamps -- one for coarse-grained timestamps and one for fine-grained ones. Add a new debugfs file for summing them and outputting the result. Signed-off-by: Jeff Layton --- kernel/time/timekeeping.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 7c20c98b1ea8..c843838cb643 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include "tick-internal.h" #include "ntp_internal.h" @@ -59,6 +61,9 @@ static struct { static struct timekeeper shadow_timekeeper; +struct percpu_counter mg_fine_ts; +struct percpu_counter mg_coarse_ts; + /* flag for if timekeeping is suspended */ int __read_mostly timekeeping_suspended; @@ -2326,6 +2331,7 @@ void ktime_get_mg_fine_ts64(struct timespec64 *ts) ts->tv_nsec = 0; timespec64_add_ns(ts, nsecs); + percpu_counter_inc(&mg_fine_ts); } /** @@ -2361,6 +2367,7 @@ void ktime_get_mg_coarse_ts64(struct timespec64 *ts) ts->tv_nsec = 0; timespec64_add_ns(ts, nsec); } + percpu_counter_inc(&mg_coarse_ts); } /* @@ -2581,3 +2588,33 @@ void hardpps(const struct timespec64 *phase_ts, const struct timespec64 *raw_ts) } EXPORT_SYMBOL(hardpps); #endif /* CONFIG_NTP_PPS */ + +static int fgts_show(struct seq_file *s, void *p) +{ + u64 fine = percpu_counter_sum(&mg_fine_ts); + u64 coarse = percpu_counter_sum(&mg_coarse_ts); + + seq_printf(s, "%llu %llu\n", fine, coarse); + return 0; +} + +DEFINE_SHOW_ATTRIBUTE(fgts); + +static int __init tk_debugfs_init(void) +{ + int ret = percpu_counter_init(&mg_fine_ts, 0, GFP_KERNEL); + + if (ret) + return ret; + + ret = percpu_counter_init(&mg_coarse_ts, 0, GFP_KERNEL); + if (ret) { + percpu_counter_destroy(&mg_fine_ts); + return ret; + } + + debugfs_create_file("multigrain_timestamps", S_IFREG | S_IRUGO, + NULL, NULL, &fgts_fops); + return 0; +} +late_initcall(tk_debugfs_init); From patchwork Wed Oct 18 17:41:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13427579 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 5673ACDB485 for ; Wed, 18 Oct 2023 17:41:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 147D58D017A; Wed, 18 Oct 2023 13:41:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A88D8D0016; Wed, 18 Oct 2023 13:41:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3C8F8D017A; Wed, 18 Oct 2023 13:41:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D12E38D0016 for ; Wed, 18 Oct 2023 13:41:44 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B40531A042A for ; Wed, 18 Oct 2023 17:41:44 +0000 (UTC) X-FDA: 81359299728.10.C93AFA4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id D5D83C0010 for ; Wed, 18 Oct 2023 17:41:42 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=d4h0E+xh; spf=pass (imf28.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=1697650902; 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:in-reply-to:references:references:dkim-signature; bh=GwQsAbGH3uc7Bl5dCiWKou9GmdhON7t4G4zy/6805M4=; b=Ks/3T4TzM2Ezrav03Eo+Q9QXRnhT/vCyRcw7pINK5CT1QSeyCh/fF71qCTVrPBdv+5hSsh ZEzms/wyNFJrqbuGGmgzGpDgq6AuzhLV+RP4sWiGlFJ8a1PbDv4FZB55hwyqvrsXLms3kW FpmBqMSCqDa8E1e4fmiglvB7AoHASDg= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=d4h0E+xh; spf=pass (imf28.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=1697650902; a=rsa-sha256; cv=none; b=6QLKfk7olHiWa5MDLKVPjmE8KmFoW2RmJqjfeiseOXBIp9AlXEehl1KMMIF3QXfoY2q4rw FacNVqN7RelYhTKPfXxK/TP2HBvkhJDfT/LixongkeM1amBcyHRIImZXZe+r9j2BjpI+J2 k3cyP9YVSW4nYhhXEz1F3HZzoo9Q4yk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F1DF76189D; Wed, 18 Oct 2023 17:41:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ABF6C43391; Wed, 18 Oct 2023 17:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697650901; bh=jEQ7N0OK0MX2jE1ssAAhSIOQltyOCrGAcxWFJvttHxI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=d4h0E+xhad+RgIDC/LYSUsIa5OZJ5j1VZUh8b0oRqYs1DhOGl3OteEmsDq5DE6dvU 4jODdH3GMFjFbOdeqzYGxevfpeSYNelEI/oGfYi8x2K6pLMy8V3EXZ1hB7QP6aJU9S DrxIEYOBoLxt+1DaqjAop+cCWxOYoyu0fZw7zUkI0gEjQocsdNCKrwU1uM3eYnxlDK 641zLCYrSN0dRbHy4sq9Biel5ccarDl1Dc/8YnpT8l0a2/E0OmT+0u2PLNfdDkg2k2 hp4P7RsmukdlDjpa0Jpk+rnM3W5E/PVmgXY4MBR7VJiI584Pt1HOL/R2mdMa8S5GML BUotD8r6fTcRA== From: Jeff Layton Date: Wed, 18 Oct 2023 13:41:11 -0400 Subject: [PATCH RFC 4/9] fs: add infrastructure for multigrain timestamps MIME-Version: 1.0 Message-Id: <20231018-mgtime-v1-4-4a7a97b1f482@kernel.org> References: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> In-Reply-To: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> To: Linus Torvalds , Alexander Viro , Christian Brauner , John Stultz , Thomas Gleixner , Stephen Boyd , Chandan Babu R , "Darrick J. Wong" , Dave Chinner , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Amir Goldstein , Jan Kara , David Howells Cc: linux-fsdevel@vger.kernel.org, linux-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, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=10393; i=jlayton@kernel.org; h=from:subject:message-id; bh=jEQ7N0OK0MX2jE1ssAAhSIOQltyOCrGAcxWFJvttHxI=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlMBjIl9JU6MnYsWK33IXzvvdM2nG21olQKhWVr 9guhKbXSFmJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZTAYyAAKCRAADmhBGVaC Fe00EADW88E+J8cw2JT7UsKSwGT9CpnCWkU+Dzs9iIt4AzRJOr48bdUPGk4Ci+js9zF2WLiSpn8 UkapvZkI2z6IhNHLGQwx8/ZTn7wb1Y0YfjThgUw+zvTuGokLT3+U+ccgN3P4QsXmRGRfr44YvPb rqPyYGUuAAlqPU3m7MHwdsADhTP6QsuYNnNK1ZY0QDXVmeIhRhN+ZfLlsIczGcCbJInULdtNqpk LkgcxIoHrR+KqWHi3rZS3fTfhPkQJB9ATKXVRFpWvNmb8TtL+BNIR3+iMnWAnftkFnTonf/BlUo 72UZBpjrU2Gx0zA01/N8U3pxr906ekp8OVvqk1OOJpBTuFyj4yeeyx85rasqXPJ/4P5oPgASoFO PcKSx5ioMrR+lJso/6OmKXP0NRkNdK7hhoA0yVMGi7ZLCprvATXv5yGbMlg7q+TOWrvT5MWJz6w XvrIsIGKmm5kkG38tmuHL/O5rapUOnU1upDpq5oGEcBiSiSwxq2bAbxzpuIx0sKV5JUTAXREGRO 2ctfeFTOg5uYEDzueAYA0U2Kqk2g2dFHc/DCI9SPZdDu9V8edLa/mgjRRk0OCNU6qxaDMK9G958 KooCxqNGtSsv1+cCNBxLI4zK210ifbeC5pkkqxVAplXfwRKG5DBkQkpWhenyKFfdsLiro1zBt/I oOC2cuZgMmPyzSA== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: D5D83C0010 X-Rspam-User: X-Stat-Signature: 3xm1znit7tqqzqzfururjcjn63xq4rg5 X-Rspamd-Server: rspam01 X-HE-Tag: 1697650902-96702 X-HE-Meta: U2FsdGVkX1+P44+SyzQ+BVPSvo5TA4m/BYmcQKVWvgpL8Nnd6rO561Pm1PP725inFUATwILkZLGrIm54OjbN3BOea9J0484KBm/3wwr19t5PFBVV48Qwr1wCIEKg9wC27YmBn91PMOCZEOZk6Eck8L79mT7I8BgMfMZHO7tUOk43bIPRwdcIfwV8gQwrRdfb1fpf/1Ro6vV/3GqtIorPgZTRakNbc20pg3N+o0BygLsCnLXFJt1CS0G9I9vyeOqI7HEMP3MIPKATkYGXe64rV/pAIXOmPSYtMiIFTOxvUlENHlHsgLpK5C2NqWB/ua35o5ZpAvWIOpCPRdKHh64DvLeeW3bJsuS2ygB1qPnXQ/hig6Z/bhNBDgT13Blc3lc/MH7YNgWVdxLACCuMuw5D0fyo6q5ymChOIBaH957l0tjp+KU+nLpYKcMdyJGV+RxY4ZhnODWtTYwDJhvDohA7sOnv0Cw/q0ccUa7BVEKGIDisfanG3DOXbMXRsuyUOkrPvwFmP80RfogeXwE00G3PibZ6irEmVUrwQWpYzwQspOnCv6KosDU9Sx+3tR1dq0FiGXyxiUntVKRqLtq/nYqXCNtJcScGi1H/mtRrSWSxyuGxLqTMonw1qhXrw34YCw0OarDZZAWn7rcPzu45KjW0ofp/VrMOnQCqQ2Rs05bReF/F05uoEoWnabkgk0b+XKys0KySsTmoqlrsrCXJ7eM7naUjjvW1JxoPWfr/vHvfN2YPLeUqPP/aUNXj4RbnNPfEE70MY6OMjf+h3S5BEx/5EFTvL1z6H8Fku5LFGYBa4CzxOtyrtBMKYPPQNR9nsvIINailorZ0pTU9yPmZYFGvYVpwIXyW1HI521HPv1wAUSaxbO7YXnUyFy8PflNj4arBt1A51V4N2EVZV4FGdb82wVcWnFaugcN7dM1ryrWHkOq+3/MXhWXAcZSikETNEBLbjznQ5zl2AZuTJc9746P SCVdYd+M uCn9aIslGOV0mW6WDYj5IBu+5ELafFtDSXOa4d5Vw7yKB61Ks1OdeGVnaA4BrGlraOfLJq7uBJ4+LOvpHMREjSt49WFDJFQhVRHTAkJc3mMFKgz8RJNTasyAf4jTlmMm2pJcadfAYenue7SE5sQW2ilOodZT9RtgpdlO2D39TR1y8/fmspeg6d6keq7b1MGGVCpeRMTnKFwN8s4pddDGL1QrGkhBU2i0UJpSo+O6MotQpyPMQY0tCXbBtb/IFycEhb+42 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 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. POSIX generally mandates that when the the mtime changes, the ctime must also change. The kernel always stores normalized ctime values, so only the first 30 bits of the tv_nsec field are ever used. Use the 31st bit of the ctime tv_nsec field to indicate that something has queried the inode for the mtime or ctime. When this flag is set, on the next mtime or ctime update, the kernel will fetch a fine-grained timestamp instead of the usual coarse-grained one. Filesytems can opt into this behavior by setting the FS_MGTIME flag in the fstype. Filesystems that don't set this flag will continue to use coarse-grained timestamps. Later patches will convert individual filesystems to use the new infrastructure. Signed-off-by: Jeff Layton --- fs/inode.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++--- fs/stat.c | 41 ++++++++++++++++++++++++++++++-- include/linux/fs.h | 31 +++++++++++++++++++++++- 3 files changed, 136 insertions(+), 6 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 0612ad9c0227..83c3378053bc 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -2108,10 +2108,40 @@ int file_remove_privs(struct file *file) } EXPORT_SYMBOL(file_remove_privs); +/** + * current_mgtime - Return FS time (possibly fine-grained) + * @inode: inode. + * + * Return the current time truncated to the time granularity supported by + * the fs, as suitable for a mtime or ctime update. If the ctime is flagged + * as having been QUERIED, get the most current fine-grained timestamp + * (without advancing the coarse-grained mgtime), otherwise get the + * latest coarse multigrain timestamp. + */ +static struct timespec64 current_mgtime(struct inode *inode) +{ + struct timespec64 now; + atomic_t *pnsec = (atomic_t *)&inode->i_ctime_nsec; + u32 nsec = atomic_read(pnsec); + + if (nsec & I_CTIME_QUERIED) { + ktime_get_real_ts64(&now); + return timestamp_truncate(now, inode); + } + return current_time(inode); +} + +static struct timespec64 current_ctime(struct inode *inode) +{ + if (is_mgtime(inode)) + return current_mgtime(inode); + return current_time(inode); +} + static int inode_needs_update_time(struct inode *inode) { int sync_it = 0; - struct timespec64 now = current_time(inode); + struct timespec64 now = current_ctime(inode); struct timespec64 ts; /* First try to exhaust all avenues to not sync */ @@ -2529,7 +2559,7 @@ struct timespec64 current_time(struct inode *inode) { struct timespec64 now; - ktime_get_coarse_real_ts64(&now); + ktime_get_mg_coarse_ts64(&now); return timestamp_truncate(now, inode); } EXPORT_SYMBOL(current_time); @@ -2544,8 +2574,42 @@ EXPORT_SYMBOL(current_time); struct timespec64 inode_set_ctime_current(struct inode *inode) { struct timespec64 now = current_time(inode); + struct timespec64 ctime; + bool queried; + int tscomp; + + /* Just copy it into place if it's not multigrain */ + if (!is_mgtime(inode)) { + inode_set_ctime_to_ts(inode, now); + return now; + } + + ctime.tv_sec = inode_get_ctime_sec(inode); + ctime.tv_nsec = READ_ONCE(inode->i_ctime_nsec); + queried = ctime.tv_nsec & I_CTIME_QUERIED; + + tscomp = timespec64_compare(&ctime, &now); - inode_set_ctime(inode, now.tv_sec, now.tv_nsec); + /* + * We can use a coarse-grained timestamp if no one has queried for it, + * or coarse time is already later than the existing ctime. + */ + if (!queried || tscomp < 0) { + /* + * Ctime updates are usually protected by the inode_lock, but + * we can still race with someone setting the QUERIED flag. + * Try to swap the new nsec value into place. If it's changed + * in the interim, then just go with a fine-grained timestamp. + */ + if (cmpxchg(&inode->i_ctime_nsec, ctime.tv_nsec, + now.tv_nsec) != ctime.tv_nsec) + goto fine_grained; + inode->i_ctime_sec = now.tv_sec; + return now; + } +fine_grained: + ktime_get_mg_fine_ts64(&now); + inode_set_ctime_to_ts(inode, timestamp_truncate(now, inode)); return now; } EXPORT_SYMBOL(inode_set_ctime_current); diff --git a/fs/stat.c b/fs/stat.c index 24bb0209e459..02d8857bac9f 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -26,6 +26,37 @@ #include "internal.h" #include "mount.h" +/** + * fill_mg_cmtime - Fill in the mtime and ctime and flag ctime as QUERIED + * @stat: where to store the resulting values + * @request_mask: STATX_* values requested + * @inode: inode from which to grab the c/mtime + * + * Given @inode, grab the ctime and mtime out if it and store the result + * in @stat. When fetching the value, flag it as queried so the next write + * will use a fine-grained timestamp. + */ +void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode) +{ + atomic_t *pnsec = (atomic_t *)&inode->i_ctime_nsec; + + /* If neither time was requested, then don't report them */ + if (!(request_mask & (STATX_CTIME|STATX_MTIME))) { + stat->result_mask &= ~(STATX_CTIME|STATX_MTIME); + return; + } + + stat->mtime = inode_get_mtime(inode); + stat->ctime.tv_sec = inode_get_ctime_sec(inode); + /* + * Atomically set the QUERIED flag and fetch the new value with + * the flag masked off. + */ + stat->ctime.tv_nsec = atomic_fetch_or(I_CTIME_QUERIED, pnsec) & + ~I_CTIME_QUERIED; +} +EXPORT_SYMBOL(fill_mg_cmtime); + /** * generic_fillattr - Fill in the basic attributes from the inode struct * @idmap: idmap of the mount the inode was found from @@ -58,8 +89,14 @@ void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask, stat->rdev = inode->i_rdev; stat->size = i_size_read(inode); stat->atime = inode_get_atime(inode); - stat->mtime = inode_get_mtime(inode); - stat->ctime = inode_get_ctime(inode); + + if (is_mgtime(inode)) { + fill_mg_cmtime(stat, request_mask, inode); + } else { + stat->mtime = inode_get_mtime(inode); + stat->ctime = inode_get_ctime(inode); + } + stat->blksize = i_blocksize(inode); stat->blocks = inode->i_blocks; diff --git a/include/linux/fs.h b/include/linux/fs.h index 78786c1c32fd..c9823ec0da65 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1515,6 +1515,22 @@ static inline bool fsuidgid_has_mapping(struct super_block *sb, struct timespec64 current_time(struct inode *inode); struct timespec64 inode_set_ctime_current(struct inode *inode); +/* + * Multigrain timestamps + * + * Conditionally use fine-grained ctime and mtime timestamps when there + * are users actively observing them via getattr. The primary use-case + * for this is NFS clients that use the ctime to distinguish between + * different states of the file, and that are often fooled by multiple + * operations that occur in the same coarse-grained timer tick. + * + * The kernel always keeps normalized struct timespec64 values in the ctime, + * which means that only the first 30 bits of the value are used. Use the + * 31st bit of the ctime's tv_nsec field as a flag to indicate that the value + * has been queried since it was last updated. + */ +#define I_CTIME_QUERIED (1L<<30) + static inline time64_t inode_get_atime_sec(const struct inode *inode) { return inode->i_atime_sec; @@ -1590,7 +1606,7 @@ static inline time64_t inode_get_ctime_sec(const struct inode *inode) static inline long inode_get_ctime_nsec(const struct inode *inode) { - return inode->i_ctime_nsec; + return inode->i_ctime_nsec & ~I_CTIME_QUERIED; } static inline struct timespec64 inode_get_ctime(const struct inode *inode) @@ -2372,6 +2388,7 @@ struct file_system_type { #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ #define FS_DISALLOW_NOTIFY_PERM 16 /* Disable fanotify permission events */ #define FS_ALLOW_IDMAP 32 /* FS has been updated to handle vfs idmappings. */ +#define FS_MGTIME 64 /* FS uses multigrain timestamps */ #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ int (*init_fs_context)(struct fs_context *); const struct fs_parameter_spec *parameters; @@ -2395,6 +2412,17 @@ struct file_system_type { #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME) +/** + * is_mgtime: is this inode using multigrain timestamps + * @inode: inode to test for multigrain timestamps + * + * Return true if the inode uses multigrain timestamps, false otherwise. + */ +static inline bool is_mgtime(const struct inode *inode) +{ + return inode->i_sb->s_type->fs_flags & FS_MGTIME; +} + extern struct dentry *mount_bdev(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, int (*fill_super)(struct super_block *, void *, int)); @@ -3080,6 +3108,7 @@ extern void page_put_link(void *); extern int page_symlink(struct inode *inode, const char *symname, int len); extern const struct inode_operations page_symlink_inode_operations; extern void kfree_link(void *); +void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode); void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *); void generic_fill_statx_attr(struct inode *inode, struct kstat *stat); extern int vfs_getattr_nosec(const struct path *, struct kstat *, u32, unsigned int); From patchwork Wed Oct 18 17:41:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13427580 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 8025ACDB47E for ; Wed, 18 Oct 2023 17:41:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 69E7B8D017B; Wed, 18 Oct 2023 13:41:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 64D7A8D0016; Wed, 18 Oct 2023 13:41:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 478AD8D017B; Wed, 18 Oct 2023 13:41:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 358258D0016 for ; Wed, 18 Oct 2023 13:41:47 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 11CC3A0D3D for ; Wed, 18 Oct 2023 17:41:47 +0000 (UTC) X-FDA: 81359299854.10.6FE33FE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id 387BA140005 for ; Wed, 18 Oct 2023 17:41:45 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ixsIePkg; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.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=1697650905; 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:in-reply-to:references:references:dkim-signature; bh=T0BXa4F/iXCKr1XfbujvgPJs4sF4+npdOyaCUKPHksw=; b=fAu3DJIWKYcjxKXR0qZDVTROz+m9vpausnjDgwQgrYqkZmR4Nda6LMYgV5m0KK0C+RlxV4 YzVTiCfzMF3S0akBgYC6Kjy+o3v2Ymcz6B+vZnbP7GDxuqsotq02OpRJvx5ldvcopPNGXk +eyzoq3O04cE8+ptgxMitVewb4klvNQ= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ixsIePkg; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.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=1697650905; a=rsa-sha256; cv=none; b=Nx/7pOBxspTsNdonB0toJOG+3/HxwJ3qMWf/jVOTbgEHlAf+vGVEQVcZSI+3XvIpn9/YC4 eVwqR8QVVeHNnHDkIdilFGYSI5Lv03ye0YP2U1KfLh0FWm05wUS0mSJNSTc/v4x7nT0KKV aqyBukEiCfpYst+tRy1sb7EyDHa698Q= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 68A49618B3; Wed, 18 Oct 2023 17:41:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D83C6C433C8; Wed, 18 Oct 2023 17:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697650904; bh=CebfTX8x0gqnWClXdb2PRiRjob3lBToUpb1yn80x07I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ixsIePkgd6FqsA4/OTA9y+DP1ZywHc7Sr8eHzCsk+2Jo01xrQdac05wRbts2zVrXc C4o0TOGiSxkweFeCUUdfA+iKlqGX4HQZPPZCWCOKfiWi9Uw2kl/nab5pguFYwqx8Ct qqWZcVRN9CSoC9SWY3fnIJGi+/4qH3kV8pkaapRaJ+RFoTnardz2xPns8JG21g8oJN syy5uIQs3ESM7Q0MoYxYJ4hmMSxmOSV0a5aaoB5lriz1+4wr2V1OVE0iP7JaYyQfkA TtsgJXdaS/oQiTQobkbvyPySWa0MnB33bAbS8srOYejBKAHotOjG8J+z20op4bFNXu WudM7ZkhM2p/Q== From: Jeff Layton Date: Wed, 18 Oct 2023 13:41:12 -0400 Subject: [PATCH RFC 5/9] fs: have setattr_copy handle multigrain timestamps appropriately MIME-Version: 1.0 Message-Id: <20231018-mgtime-v1-5-4a7a97b1f482@kernel.org> References: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> In-Reply-To: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> To: Linus Torvalds , Alexander Viro , Christian Brauner , John Stultz , Thomas Gleixner , Stephen Boyd , Chandan Babu R , "Darrick J. Wong" , Dave Chinner , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Amir Goldstein , Jan Kara , David Howells Cc: linux-fsdevel@vger.kernel.org, linux-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, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3403; i=jlayton@kernel.org; h=from:subject:message-id; bh=CebfTX8x0gqnWClXdb2PRiRjob3lBToUpb1yn80x07I=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlMBjIhGAfiHKR2+BMhUvK9Je6zSTAJVNLPujGV e1DN/iJrxSJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZTAYyAAKCRAADmhBGVaC FTarEACVylMwhcX6PLK1jzC+Yj+mH5qYypQpchyrOIktUb/AdxXRiWd4sKMRH5DU4sFFxFJHWce 5f8A/LDi2QaJ6fCzZZBK1cfvoc9XAiFCKu3zpxBEmaq++/tX3P2VzqRWTnfE2tgWmG/aUn4Z2tm b2cUog1WhdPXz3ubERRvWNE5WLzgVXFRRtarU/5kEUcrj8ungy2NjdEhUktZQuw8H0+2limB8YS qRrTP47cjY2RtdJA1+X+67DLw+bYymJllU7Db9sEu2CAfCTOMOxO2euB+OHR5wChJas4MjGcc6G WUdoSjOTPlOoiVrGLu9y9zHcC9VUonbBRmRYxTMcIon/aO+1gap4ByfnVvdt0/UhmmD0+lw2wJO G7HUB6PJWXGynG3IpGJorc83Hzi/TSAOc2+zQ/bwZ02IvpHBErXnfh7Nhp7LvyB4nlhJLlvQ43+ TDqOaNj56qR+wFXSFQ83K/wdzpvk1LLbew3buvB1FzEKWdn8RvUU63enQBXlkZ0iUDy3I8dtMUA uWFo0dsHzQMbv6DLYthwF6cJWkmgwEWSCevnwHezl+RA1uT7FSY4RpdjtP99UYzDNh+jqQ6Jbq7 jmJjT0+Lav0EoWH6NwVtw+QqAPT+fxHW3d5Q91P12s38P2PtFjUndb2Rf7IXNKwdcJV9mgtdc+3 9sLsvNrKr7s47Jg== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: 387BA140005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: mziktymgmj6mo7hnrpeuohfra3nnuuya X-HE-Tag: 1697650905-870697 X-HE-Meta: U2FsdGVkX1+SjAIWWIkD4A/XghweQbilAwMrPmXhIS6MeA8s42JtOmBfNPVu38sH3zcubUo6u5hZB9Urwt7iO+YYp/Y/h88j41Fo3RnX0b5ey85GYkAhyNGhb817HTT4/+WwDQg1l2M39fVek60zBJVmcVIKQhhjq1gloMA6RWC3Wb9rYUbKCCPmpvtl/wQ8UJSAtlQtxkEavBDYxhj57Ggtf408brK2Rar7RkeDsh1KCKdhOq0XNtx3xevU5MIuK+G1TKeqIS2RAsQe9PCJvvWNg7qIVpyn3gVMjrnnB/XTKLM3+GHep/YGx2adOwUkHSHuWQrrrAYZJpFLehs7UC1eL5GRD3J+/TxMy2rgQc0Kymiv5FJHb3tS2jO1Bx32BLxvoyZixbg9Z5FZhWpBV7G0rUXNW1/nwd0YvqRS2nFhfdTXXQnUYBV1ZgqEPmX91V/u7/o2vn8yq3YFhodrvIBUEpWpDEOMKcNQ0hk019rV7WxXObdErc3cFK7lB3PQyK/UyQSiIRcvaAGquZOdLY+rcpz7RAZsplTWrRsv5LFnJ7I4vJ3TkixBkJQ2UBGTwrxcdoVAaWWC7RbWP78/zgzNa7vca/oFpnErsN5rGRv5/MNqx2q7TrdEBsibF82qOEv+ArukfFs4xNbcKZ/ajRWryWiVYjqGQjq85sNWpG4+L7mOIweIRYpiSB+BggJi2JD4K5Qx9cMeT6qIbVzJk6JA/+wX8PVHZkh0Fxb/8q4YTeOSBVlZAJaKmnLI9WHlgygH6xiOsuVIsJeKeYRZgDad7/vSWF4f6HbPq9uaWxdtMfRxie1nORVwumeJXMwoBPm3jXi6i9Gr5EJ2ESN2oXkydbK/JDrdL//cKJjkJavnlQyZ8nWEsYDjnNGhER0NnjGpbXWnD/+hzioRLB72M0afVDrgMSq8ar4Ddvm7xNJN8ovvM+ktlyllOXk7QtX+o2c/bb5A+zpuAYlkjEc ksGZUVH1 40RamLnCqNuozJevE6qmD1tRcG+0rarLPVad1Wp8MzmFTVZpUvXhP0kqZkWBIkaOSjtmGr0JBJkq4GhwwSGO0RGjXqDm3sfXXBmgTh3gW6B3UNsLeY6EYlpgBHyeO3s8ruN0S1Y0JulshNccM5DzE0QbaYGBWU7vM4jdF4sztYxL3x+NIYoynMe54Cp9l6syysj3SLp6EdCsslxKHt4I8k1caVcYn+DsV4n/r0wjS80dK1Pf324zwTcM6IE9c1mnAty6F149Qt+tkmJ6TOUzrWDqViNrqcrTEBfHsJ30UT3gONtU= 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 setattr codepath is still using coarse-grained timestamps, even on multigrain filesystems. To fix this, we need to fetch the timestamp for ctime updates later, at the point where the assignment occurs in setattr_copy. On a multigrain inode, ignore the ia_ctime in the attrs, and always update the ctime to the current clock value. Update the atime and mtime with the same value (if needed) unless they are being set to other specific values, a'la utimes(). Note that we don't want to do this universally however, as some filesystems (e.g. most networked fs) want to do an explicit update elsewhere before updating the local inode. Signed-off-by: Jeff Layton --- fs/attr.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/fs/attr.c b/fs/attr.c index bdf5deb06ea9..1d3e6f562bec 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -275,6 +275,42 @@ int inode_newsize_ok(const struct inode *inode, loff_t offset) } EXPORT_SYMBOL(inode_newsize_ok); +/** + * setattr_copy_mgtime - update timestamps for mgtime inodes + * @inode: inode timestamps to be updated + * @attr: attrs for the update + * + * With multigrain timestamps, we need to take more care to prevent races + * when updating the ctime. Always update the ctime to the very latest + * using the standard mechanism, and use that to populate the atime and + * mtime appropriately (unless we're setting those to specific values). + */ +static void setattr_copy_mgtime(struct inode *inode, const struct iattr *attr) +{ + unsigned int ia_valid = attr->ia_valid; + struct timespec64 now; + + /* + * If the ctime isn't being updated then nothing else should be + * either. + */ + if (!(ia_valid & ATTR_CTIME)) { + WARN_ON_ONCE(ia_valid & (ATTR_ATIME|ATTR_MTIME)); + return; + } + + now = inode_set_ctime_current(inode); + if (ia_valid & ATTR_ATIME_SET) + inode_set_atime_to_ts(inode, attr->ia_atime); + else if (ia_valid & ATTR_ATIME) + inode_set_atime_to_ts(inode, now); + + if (ia_valid & ATTR_MTIME_SET) + inode_set_mtime_to_ts(inode, attr->ia_mtime); + else if (ia_valid & ATTR_MTIME) + inode_set_mtime_to_ts(inode, now); +} + /** * setattr_copy - copy simple metadata updates into the generic inode * @idmap: idmap of the mount the inode was found from @@ -307,12 +343,6 @@ void setattr_copy(struct mnt_idmap *idmap, struct inode *inode, i_uid_update(idmap, attr, inode); i_gid_update(idmap, attr, inode); - if (ia_valid & ATTR_ATIME) - inode_set_atime_to_ts(inode, attr->ia_atime); - if (ia_valid & ATTR_MTIME) - inode_set_mtime_to_ts(inode, attr->ia_mtime); - if (ia_valid & ATTR_CTIME) - inode_set_ctime_to_ts(inode, attr->ia_ctime); if (ia_valid & ATTR_MODE) { umode_t mode = attr->ia_mode; if (!in_group_or_capable(idmap, inode, @@ -320,6 +350,16 @@ void setattr_copy(struct mnt_idmap *idmap, struct inode *inode, mode &= ~S_ISGID; inode->i_mode = mode; } + + if (is_mgtime(inode)) + return setattr_copy_mgtime(inode, attr); + + if (ia_valid & ATTR_ATIME) + inode_set_atime_to_ts(inode, attr->ia_atime); + if (ia_valid & ATTR_MTIME) + inode_set_mtime_to_ts(inode, attr->ia_mtime); + if (ia_valid & ATTR_CTIME) + inode_set_ctime_to_ts(inode, attr->ia_ctime); } EXPORT_SYMBOL(setattr_copy); From patchwork Wed Oct 18 17:41: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: 13427581 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 A820ECDB483 for ; Wed, 18 Oct 2023 17:41:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 395648D017D; Wed, 18 Oct 2023 13:41:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 319D18D0016; Wed, 18 Oct 2023 13:41:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 146438D017D; Wed, 18 Oct 2023 13:41:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F369D8D0016 for ; Wed, 18 Oct 2023 13:41:52 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CBB8C120C1B for ; Wed, 18 Oct 2023 17:41:52 +0000 (UTC) X-FDA: 81359300064.23.0A6E413 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf23.hostedemail.com (Postfix) with ESMTP id 4989D140017 for ; Wed, 18 Oct 2023 17:41:49 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qSRjlWxn; spf=pass (imf23.hostedemail.com: domain of jlayton@kernel.org designates 145.40.73.55 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=1697650911; 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:in-reply-to:references:references:dkim-signature; bh=M8sjly69+WZq7uxB3fHk0h1KzutYv+TMgOa3J1WeaSs=; b=wa3UEj4W8HQo/nJSkhbmKFVx2UgjjJ7bWEVW7AqQCTYaCu1FlKUJMLBUWlzl2PwFHtehFV aXtfZmcWU/89PXWPt9BgEmlj1cI81PIqS2s+VO+1wXDFazLsxvnQ4ATrJZ56jl5UT1nFLN 9JDaarKJEbpnPjeBbKjl7jez9GZZjG4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697650911; a=rsa-sha256; cv=none; b=zQfD3tjeHp0qtX9bVwlAcXtC81PhWXD1aPPjEnINPL2W/oN+cXYVbgeEvzolSC7yBMSlxt OoCNo0ag1E/2d28J+CHj3RafHb4i4vboRwHz9KTYLPdLI9WdTSK+vgEa2rZMds2ox17ynb ezhukHrzWRapwxjsc7qR8WM3aXdPpMo= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qSRjlWxn; spf=pass (imf23.hostedemail.com: domain of jlayton@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 49730CE2659; Wed, 18 Oct 2023 17:41:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53267C433AB; Wed, 18 Oct 2023 17:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697650906; bh=UwK4Bv3ROcgihmcvu9msHTDCqtlMi8PO5kAJpB/lfoU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qSRjlWxnNTwfGNV0Q8mT7NMDzc+qlSVW/LwsSsZeLwGGA+yuvWHorCuNrchwFb9iF 3oyQEwhmcOSX3YnhNDQKjxLGNdhHfjxGp/RF/UJRiTbFcV6fsdbOFeo7tENOSIPiNQ Zzb7nN41F8bCvJOHamRpFJ+SVAHhSJWzfR+zGMNBY/YBEZZx8poAFbXMjt/EKBoB30 hR60uckQsneqXI7s583v+itxW27moXjS284cFZ7QgCiw1HjSUAQMLgdRJVfLiUpGPu Ds5zGhz8c78Zy02SXFQoFmO8fZClbEDstAq+fFFgUMxs8yH+mp3CZ0GN7EyyMoen9w LoHURLczzAP2Q== From: Jeff Layton Date: Wed, 18 Oct 2023 13:41:13 -0400 Subject: [PATCH RFC 6/9] xfs: switch to multigrain timestamps MIME-Version: 1.0 Message-Id: <20231018-mgtime-v1-6-4a7a97b1f482@kernel.org> References: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> In-Reply-To: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> To: Linus Torvalds , Alexander Viro , Christian Brauner , John Stultz , Thomas Gleixner , Stephen Boyd , Chandan Babu R , "Darrick J. Wong" , Dave Chinner , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Amir Goldstein , Jan Kara , David Howells Cc: linux-fsdevel@vger.kernel.org, linux-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, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2416; i=jlayton@kernel.org; h=from:subject:message-id; bh=UwK4Bv3ROcgihmcvu9msHTDCqtlMi8PO5kAJpB/lfoU=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlMBjIefuyPVHvdgVpwhPPX60qe6wZ15TLHB4LG U8E6+7devyJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZTAYyAAKCRAADmhBGVaC FSDQD/9RrJmco0fSAbgHolmtMmOGKyJDUH+Yax9DZo9G33gFEq3gimnaRJBR7FCRyasd67VQqQT hYeUH8BlluxEFXYZssDkYOl+t7b3HZmPCdyjwhVXzaAg7vbjWghBWGHQbHFFkl9wbhoOWd6gusy zH8QXWGoN5Wz9Sk0Q7QILoMytEya3RHTnmDLbcSEfWg9YAQSNATIZcaNaqWtLSLbEmBGqaksKVY hbbxyKpso/ifX23/Qgb9IMo6ODHPPbV28AbB7kQZV21RqyeEZ+k+Jonlk7aIADMIw9bsFhzOxhO rmyxKZvBUTql2YwcvoFAo3NRjZpQmvfzBRK6Ax6WSMF56OA7XcUqNFaEMaFxhjgAPjZpCxbZfW5 dGjJmnna8XkCv95PUOAtgDLpFAoEJSOS7XOgQ3VSGcSNe3Vvrz0K9jrvkiZf1WyyaHNRPXvijbC DFZX7Pi40JztALqlqNMKTidN68pBd4uvdv5Qk2L8ESP5gf6TaGH16ah5yoj3MAIhT+stlHFT55G Ejzaitu1cicbPvrUTz+i6+YFWFd925Q9EZSLgg3aAka5jtRQ7am7C4ciUbSURjRoVdtQpmrfssX BoFbvPeT0DHZbtZwjdmxDip4mLT5dAVaobppZYIlMhcJlEBN6toFJuE67SPBL4hqePRjDXhm9uC B/Imrrki4dThCiw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Stat-Signature: zfeurptccaqs1rjz6gbtx85ss3bdjjcg X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 4989D140017 X-Rspam-User: X-HE-Tag: 1697650909-153424 X-HE-Meta: U2FsdGVkX18rlMWSrIXMPrfi69ItNFuDekgADS13EXTBY/5mRLNMAJ2EYovml42Qp8dQSScUrscViu0Jpx/08+zUl7y1Y44FOCZtor19TExXM/dhdrfDu4tBTYjjrQXTiWbhC9CTjX91NkfvlMj5Ym7lI1qazEysNAYA1LjCY+lzbSt2qdE4Ln3gfzlOo6pq2OWMw2PbgfYT2TKHcgm3jZDpI2cjuEv8HAI2vG6R8nvOnEAQMAGo3RWwldnJ8rpyVwjTXSzIAZR0QP5gxIJbMnok5FSPLSVYBet/pSqh7plzSBY/g4qQlwch9Ss4W5qtmd1f0cBntuwp71vRqJs3DYkv8CTjJbWTRL/QJPh5vN67Hr3CW1ENAb9i/PrEdu3B8nIPJG1p2iu4VxNBHJAZ7QxLfDqvzVBwBmB2Ik4MbMnQcDSfWckjeR305dMdTGKDjCAT+RVqXKzXZeIV4We2GsC7+XnyF6tcKk3mVJKIK3Ee4a90EgJ+3Ih1kUCL5sMI8ish+Oy+Z03IwteCMWhv8w2Dds3Qp52lXg65WDwwkPzy2bCFOjCw46SNiXsGQGLp5kQVChvRnu4HgJTLRxG47WBJW4wqo8H1WQVJfjdJyjTJIFZHOq3d6b87v7az5sMgk9WqRRILtQYuoU0O9lGOTfW5/qEaIHn/3sTds2RCVP66e3i4wQN2NGsJEmud2CTY/K8gKzm+LGZVh0W/oAT++Q93z84A1Njn4HjfF0j2qdqXpQJ/2kk0zaD2ZXD8EwsVDWdhpvZrEu8KLnHsO57XLAezQ42rr6STX5uwY7JZ5FIO5ErNbOIQ7yss+FxK6pEYdJtgpZEXPfKvNJGK2L85nBMEJjzaq0wCqSx1oORoWOZbzHHNucwaOJYLE/Gm7Qs2LXPfIcUJbYIRslAHwt8Kd0T6ZpXKXVztObMMWgAQfN/uLjhEvTh9Vh9gFSDRNb2whO3GHwl21nRx5zQECkV AVNgRxN6 5f2dAT+m/nE3YOD5qQPySFvuhoCHcQewbXWZM5ugVIWB8coOpvwgu2IgeQqwgnZnKmEFlwIvPaSRD7na2mFYeAaoFRbKU/a2fPKNWPgoAGcRwEEnLWUiVl7vfUhS4AekWNseaFLfeozWE58RYsAbiFalcCpJauYZAqI5sQYJUFbpXJFADPhcb4mX8OdDN7DFNX7HL8YYwxIKrRqSwz03Jg7Hx62yekkIicxMe0zGsNYTEXznBUyTIoQ+nMQ== 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: Signed-off-by: Jeff Layton --- fs/xfs/libxfs/xfs_trans_inode.c | 6 +++--- fs/xfs/xfs_iops.c | 10 +++------- fs/xfs/xfs_super.c | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c index 70e97ea6eee7..42e4e6e964d2 100644 --- a/fs/xfs/libxfs/xfs_trans_inode.c +++ b/fs/xfs/libxfs/xfs_trans_inode.c @@ -62,12 +62,12 @@ xfs_trans_ichgtime( ASSERT(tp); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); - tv = current_time(inode); + /* If the mtime changes, then ctime must also change */ + ASSERT(flags & XFS_ICHGTIME_CHG); + tv = inode_set_ctime_current(inode); if (flags & XFS_ICHGTIME_MOD) inode_set_mtime_to_ts(inode, tv); - if (flags & XFS_ICHGTIME_CHG) - inode_set_ctime_to_ts(inode, tv); if (flags & XFS_ICHGTIME_CREATE) ip->i_crtime = tv; } diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 687eff5d9e16..8fb251cbe061 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -573,8 +573,8 @@ xfs_vn_getattr( stat->gid = vfsgid_into_kgid(vfsgid); stat->ino = ip->i_ino; stat->atime = inode_get_atime(inode); - stat->mtime = inode_get_mtime(inode); - stat->ctime = inode_get_ctime(inode); + fill_mg_cmtime(stat, request_mask, inode); + stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks); if (xfs_has_v3inodes(mp)) { @@ -914,12 +914,8 @@ xfs_setattr_size( * these flags set. For all other operations the VFS set these flags * explicitly if it wants a timestamp update. */ - if (newsize != oldsize && - !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) { - iattr->ia_ctime = iattr->ia_mtime = - current_time(inode); + if (newsize != oldsize) iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME; - } /* * The first thing we do is set the size to new_size permanently on diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 819a3568b28f..c8a2dae1dd65 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -2033,7 +2033,7 @@ static struct file_system_type xfs_fs_type = { .init_fs_context = xfs_init_fs_context, .parameters = xfs_fs_parameters, .kill_sb = xfs_kill_sb, - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME, }; MODULE_ALIAS_FS("xfs"); From patchwork Wed Oct 18 17:41:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13427582 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 DD131CDB48A for ; Wed, 18 Oct 2023 17:41:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D7E28D017E; Wed, 18 Oct 2023 13:41:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 787AF8D0016; Wed, 18 Oct 2023 13:41:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 600AA8D017E; Wed, 18 Oct 2023 13:41:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4D92B8D0016 for ; Wed, 18 Oct 2023 13:41:55 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 23C5A1CB548 for ; Wed, 18 Oct 2023 17:41:55 +0000 (UTC) X-FDA: 81359300190.06.0BA60F5 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf09.hostedemail.com (Postfix) with ESMTP id A9691140018 for ; Wed, 18 Oct 2023 17:41:52 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YYfoYs3O; spf=pass (imf09.hostedemail.com: domain of jlayton@kernel.org designates 145.40.73.55 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=1697650913; 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:in-reply-to:references:references:dkim-signature; bh=5r5+xkT7Cah6bqzzux7AkywwCv2DT8B10T1+CCXYhPY=; b=wWieBvMzW85V9oM5Y/GpPMvtP8ytpbMDTLm+7eL/VjYgAulLhDTnjEv1XY6TRsyu+TCOmw 1oZRrsGCQYFAmVwrqKZ8CVJ2pPL9uIngNgohWK5IakI9fdFwNTDXlgAB1NPUMQAMxSxLpm z/WEjUAY1mquGxXYJ1L82cPX6fR9ma8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697650913; a=rsa-sha256; cv=none; b=ec2ytfk2d4cIaiISsSvjVwamP2NbZPS3bBEQdTAs46ZhVzfn9L0XPnJFU8cHSrY1RX0PcU lceD5pnfNr0uM0+TJBlS5e7eKocd/cdWf78lT1fM+p6QBYCZN3zrdjlKPUtfTNygj8GH1k udDCj6qPiwWvAnenpq24t4q57gqlwrM= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YYfoYs3O; spf=pass (imf09.hostedemail.com: domain of jlayton@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id BAEC4CE2657; Wed, 18 Oct 2023 17:41:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6728C43395; Wed, 18 Oct 2023 17:41:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697650909; bh=4p7KAc4dsK8dQOeLACIwEbavFhpYUlO+UH4AD1OreDY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YYfoYs3OV3OwOoWHJrW77sJgKOC9d7+Xq2vmQwl+Dj5UFhipFADNwQ3Z5KsSsLnjj UVCEUAP+RmDftyHzLhd05wa4Wr9JjLoXLiMNGfHoXxPtQw6AiZe1Lab31EqC9nkk+X SLlEIufv3uKJdxWt2FX2w4ro0YBLs4r3yGGJ2HiiiEmoFU5P7wRsFwR78QI3BZcJKQ JrJadB8JAr5Za++uEa/DHUlvVAmSgMmyDqMs/P/f1w9aWxEst8sifhkZCulFbhCaER HIdZH+kCXuPghYLEvCgDz0lXzMwGopN027mxaYxLLXwTEd1iaD7Uf5TKOI7ecwuiA6 nO8L4XBZg8rPA== From: Jeff Layton Date: Wed, 18 Oct 2023 13:41:14 -0400 Subject: [PATCH RFC 7/9] ext4: switch to multigrain timestamps MIME-Version: 1.0 Message-Id: <20231018-mgtime-v1-7-4a7a97b1f482@kernel.org> References: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> In-Reply-To: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> To: Linus Torvalds , Alexander Viro , Christian Brauner , John Stultz , Thomas Gleixner , Stephen Boyd , Chandan Babu R , "Darrick J. Wong" , Dave Chinner , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Amir Goldstein , Jan Kara , David Howells Cc: linux-fsdevel@vger.kernel.org, linux-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, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=839; i=jlayton@kernel.org; h=from:subject:message-id; bh=4p7KAc4dsK8dQOeLACIwEbavFhpYUlO+UH4AD1OreDY=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlMBjJsAbzUTfA1QPqzg0MuGg3swqrFXt6uvW1m bGS00EFnDmJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZTAYyQAKCRAADmhBGVaC FfeYD/98fNSYqHhHFEvbqhES3uKXfBN7CAx91j661F9ZNuvn2CUIquUaA+FfPt5NpL/7OW1KiHo hcxzhv+n0ws5nkme7kVxjI1jfLKkHNNOrue4gPlc1uU8+6SJ/oW//BRSV+nVkhZJtmIBtz7FJh9 yHdA4QbXq2qZwMBMlh3eRQTV913fwSRViLHiYkQYST4FOCORzm2QDfAeQNTscPvOI4ewlnaD/ep 9OIszxsNlLeabXq5eTdHb+tAWYRAcLzGpRDDB+mmxJsTBYPx60lODA9tFAUBrGmwxlDIHNmYx+P TornDYcILN2sWjoW0bqNmlRzp6iY037toqRYrQ7JjWhqpujus+aarDdugYY+r4CECwvRypVhGxK uWz3jjn1nlJmmBZmavbScjo3jReAgwtwxuTgmQQrYqPxwZS0ts3pBhvgk2atABZVejYvtAmZw93 QlP8V1GdxhdElp/hHiUK+LBRy0pKGK0lUt4yzOM5udaB7LCwRCIClVUhQ/IygAEikJXhCqX1de9 ogvCF5Orn0HR0YUZ4mKJ3WD3Oc2V7bfeDJ3zo6hBvWjbiSr6ZXixhXHy03d0TlCIyP+pPfmib9O Hzz0pNgcBzA4WTTYeDb6RhPTqh9IfJli9Ntp5lFmYh+Juwu/yH1cI4E5jnLXa4TO/ziZvclczEQ 7oglGUSvni3TcVQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Stat-Signature: 4cqgronbcry387at3nky58fmy1u9pdct X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A9691140018 X-Rspam-User: X-HE-Tag: 1697650912-492264 X-HE-Meta: U2FsdGVkX1+mtR+KP9kUZ2B5Tr+oUjWiOASBKOwfqYBIApWolauHxD216wEUNO6ej5Mx2oKm7pNN1i9JLqoHeCFUDroLaF88v/W1G0Axa6FhY/FABhI3kq+EeTtAuC8zBJQ61DkSk8YZeK6ujxLV01jOQk57hRskaZHGcvNA311zNlaXci1kAPb6THzEReaVZpD7X8iU3DkkRP1iLOFH4itod9n+6uu4uAuuSYG75rvdeqX2lDDr2/woHVvU24IjWJoKZYokM/9L3HLi+NlN0pof/+Kyez+GKqqD6Go9QFtQXZOWuTJXARCQSpMpuJfabE9hy4F1A0otmFAY1zjS8+ezp3Bnc2zvBivWcQxjP2MpG7/5fBYzC0/vy8fcbfpi/idDMsrdY87Or4E9ce0I5YOaSCYAjhgyHgyCYHvo5SDGkbfk5aVwLeEggV5DE8UO69S8c5SmxRWna/zIG0p68na1BsLdkLkrv1fB4V/hUUs/JeM8CfABAAkNT/dr7qQMC9Ed9QfIbSVgtOcUyODpzJKukiZbbdmlMGaD5B/wRyubrR1oqXGMmVDEtG6ePQ77QG6BTo+XFu+osp+IShN6sDItoSvJwNTKWdXq45f+tMkp8nSoHx2GNPaytvZpeAzuENwGjcFUi5uxvnmFGuVFRM8Q42SEAax6r7Dfe184hpLplNLRZ6AUjYYbFrTbRxRZhznz4HoCPIXqpJFsSuqPteJpvaQGPL2nVPPb8VPs2aXwa5FvKV3i4igWpuDRKlZh0XPnLiHL/X76UPKqb6AczB5GSemLCZzFqwbnVczFSPk5mY7fqZc6h0AiGBhD9hC/AcHamSs06WrMSri0w/i7gwW93YFiU0dpEOnyPWaiiD0vKrAAMQhiVJV8GPESNtSRBcHYWkzYBFN38h+EsuFphcZhE0WfVZy6UjFxAlHLFzR6q0MYKWrJKtZecg6kIW4vFdi8KGI4CxuLgIBsxjG nt3NOfKL NQA+AVS7EgbFCBiADYeL9riv0FY40JzqQ3oovn5AnGr47swDzNM1c3a1bzQ3egDtIDt6BuAWcT6VuCmh+WQufes3WdO8ANZI28L9CdKrOhPI9vXxOjJLb5tE4T+2SrjeVQiTtBY0JKPZ29qTrs0kHvxrw7FFFX5ZVOHLCrJorW2x0aP5u6bHmas1xXm3kTeX+vKGVhDoAjEvohw1uYDhl7iqOQXGWcwfSfmEMFoidraV8xnKgJh9CFA6edw== 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: Enable multigrain timestamps, which should ensure that there is an apparent change to the timestamp whenever it has been written after being actively observed via getattr. For ext4, we only need to enable the FS_MGTIME flag. Signed-off-by: Jeff Layton --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c642adf54599..1b111cf4ebe7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -7314,7 +7314,7 @@ static struct file_system_type ext4_fs_type = { .init_fs_context = ext4_init_fs_context, .parameters = ext4_param_specs, .kill_sb = ext4_kill_sb, - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME, }; MODULE_ALIAS_FS("ext4"); From patchwork Wed Oct 18 17:41:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13427584 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 1FC7ACDB484 for ; Wed, 18 Oct 2023 17:42:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E41A18D0180; Wed, 18 Oct 2023 13:41:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC8F78D0016; Wed, 18 Oct 2023 13:41:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C418D8D0180; Wed, 18 Oct 2023 13:41:57 -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 AF8428D0016 for ; Wed, 18 Oct 2023 13:41:57 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7B36BA043C for ; Wed, 18 Oct 2023 17:41:57 +0000 (UTC) X-FDA: 81359300274.10.1F91264 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf20.hostedemail.com (Postfix) with ESMTP id 1334B1C0005 for ; Wed, 18 Oct 2023 17:41:54 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="W/ufbXG6"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf20.hostedemail.com: domain of jlayton@kernel.org designates 145.40.73.55 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=1697650915; 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:in-reply-to:references:references:dkim-signature; bh=3I/im1cm3Iyi8zoSuG5Q4U80yeBCLsvqQYdBnHrWXJ4=; b=VabfWY5A3A9OHSygIryh5DbDblzaYaMoL6XtldDrxr4UhO3/MCP/ShjDQW+NkarMnEYHeG U7YuqbkMF67BCfgHoB6ozAsjfT27RVQzfg00sYmy0ShFHPw+CHL1HkiMPxG8L9H6x31lRt A3sGabyXLZCQapIxsdVO8IBEjzf+M0A= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="W/ufbXG6"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf20.hostedemail.com: domain of jlayton@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697650915; a=rsa-sha256; cv=none; b=zTdkBNsYzAbhxd9r8FItn6G1Ory/7KV1uiG2WqVeQ4ZURe8vTE1M5QtZLcf2shbDhlQcmu sMb38kCH2QVegmv289ZWN+j3u2M4CfjDhm+rsXObJNsOQ+Y/C0F0XvShU0BiIWPVopMgQL y1exRGd7w3q+kYa6BM7qtoYVUYiIpfg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 36509CE2658; Wed, 18 Oct 2023 17:41:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 438D3C433D9; Wed, 18 Oct 2023 17:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697650911; bh=08peVOKZI4MR32wuXNO48w8LFAelNL7UOowvOcywmvk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=W/ufbXG6bJI9e49CMjNUjxnvN8rpYE07kV1Uv10lbs/C8hNuvNOyNt34VfqYnC9DS I49zl61Mm94s/lF9vju5dzbq67/qC6Ar9L8q60dVvEDaVDtocmAwykqrLymr+qZux/ lVbBynbEAYYfrdp3mlaPnhPGOSlk/bLGkiSCd3V/9bKS5BgA9OPrfvjMa7CO0JzooF M9MdsOlxGkVapwTxlcbX6mNMMUoJtnBk5eL19Gf1y3rjt63K4Q+9v6Pai1IDz/fGIO pb4hveW0yjsp2pnmsVFm6s91KvwIgLFKzm8zK2eCovTbh6AP1vv+TXLbdyc/5r18WG RuObwSWU6PuEA== From: Jeff Layton Date: Wed, 18 Oct 2023 13:41:15 -0400 Subject: [PATCH RFC 8/9] btrfs: convert to multigrain timestamps MIME-Version: 1.0 Message-Id: <20231018-mgtime-v1-8-4a7a97b1f482@kernel.org> References: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> In-Reply-To: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> To: Linus Torvalds , Alexander Viro , Christian Brauner , John Stultz , Thomas Gleixner , Stephen Boyd , Chandan Babu R , "Darrick J. Wong" , Dave Chinner , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Amir Goldstein , Jan Kara , David Howells Cc: linux-fsdevel@vger.kernel.org, linux-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, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2744; i=jlayton@kernel.org; h=from:subject:message-id; bh=08peVOKZI4MR32wuXNO48w8LFAelNL7UOowvOcywmvk=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlMBjJZH0sHfYjXHZeCrVOFs/hUFjZBM0oBFoPW KoouqyR/TCJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZTAYyQAKCRAADmhBGVaC FSbeEACAUjZExA/YblPlgkxwqx2TRI6TFuS5NFnYMhcyki2B2XIkJnpD00JJl8GKM2MskyOvrQ8 Yd7Q8MzEyeQXxkNNt0V+DWuQYMst+8EKu9X5/T7v/1Anjkaz3ZzdirOXSZR6N53cMMLFGgSpJSv mUGs7YUWvT8XrGon0xoQ1CIuie6MmZkT5AQfZEc/0tTcmqk9uNg2/4VypX+oQeNMSyMf+xzO7Ss iQMxMetZB5ZQB1goTm4qxKjeOI3+mzLV977iDUyM96oHtAhYzUukSms5Hw6dNZDMRFkzOweotXZ IXY180/C7BmfVwV7MGwpqfVBRWiVNZEJDRERUQGB3cXYfYlETLz0enJOQvdvw697641AptAD0RD 9sqdT2M5ue6hTbEBj0y/DtlwhFPMeKr2KSDih9MgJZiqUPD89I/hx5RtNbvWcy8QM7ZH/+HVbVq RPl5tV9C0deifptk08XdKAgSnFPEg6Tm5ahINqN5V+lYnhd/b9CjY1kShQfBjex8bwxaUXnXMAq VZamJx2U4u1P3bNGzCpoON3dNyRXvIx3l3Kyc2E4+la0DaCeknTxoXrKWabtu31CEFLEsNN6QGj bC+V3q+EAl3kxNPQV7gpgEJKVOTyWeBu30B76+qZgKOQk4JrNb2ZVmXK2Kj3VHs7OONPBZShAfo fyUe5HZ/2zFbI5A== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 1334B1C0005 X-Stat-Signature: kfrubszby1edz1bbm3rh9qss44upau6h X-Rspam-User: X-HE-Tag: 1697650914-262795 X-HE-Meta: U2FsdGVkX18GYv+MegowCi9yXcsNrTgBXHIMMX3Vt2D7+4iu/M0u1ZYPrJB74weUfCuND3gQRjhjh2c0ajlfuWbJx6KAzdg06+/lCWQnxkB3xRMVcuOUNds8QE69EUDr93pFmqaz5TAko3xzDMgSD7HjGS1AaEFMjUzr/ZrY2lY3fHceft1rM+lZHPB9JlsjN4YJIu2yYNxiQ2noygMLr1SqbE4NBYuflnLT8iORm1FYkpb7y0tf/2Xydj5zyffBNykVTcVlae4+rjIGJv3/xWcep6clIokW9x8ATT61HaGDscVGhpfIrbVF2fB4TNq8CAbMUI14DQj+9XUbGRbPFikUXi1KyKish3a0AHBFvEo2BtFW0o5yALK4zBqdVb3cC03aBmhPuGQp/UIm4vqAhrexdZg19uTrRnbya2hzxwKBfqdZ3WHsdc0MF0HjP7xc/NW5SbPRde1N0nQ2tz2N1SIbkGYfbow7WPTlPNx4emv2803J2DVIcsZNfDRI+75GGoeLpJbNlfD9J96rLEGUNxdaZocQ+x5TFtzt484PWT13CjF7VXbVHgV+rq1/cptSatNQxVx3dRyMOEqPgCoCRrmcr4PKlAMCUaqNazRE/PxBLwSjYoaCiXR1qgvNShswlJrOVXlFb+DkJNfGw9QT55pDrUulMg4RMPTDEnIkgx3lzPyPa++yOWTS2PuRNcmnegWCAu0Ru4xPleWAibWghFfNhpFnoEhSDJlYyonylvuEaXjaSGeMKdMRWA/NzNQhP3bf4H6DrhhAM9+uOtV0J/2NOENPzocN0xWrad/X6NsJ+NFEypOmt89RQarThCTmgwwJcNbT0H1HHbCAJCB0rHbiuA+0fbqn3za4gre0YU7E7jwRFF1QhagUAC/HK3PvpVz/rhMRlQ5R70Z7QCXe4gYmlpHbo1HPip1JNZTGNf38EBjnBzyPqQwXxrr8ElyPEx7FmP9nPZIbvo7D6xj yhEEwHGn EOPEwz80UY7ZU0WwEiNWbiuBKqya17Khr9WoQX9lvArpqMwQZdpJ1DW8f3vZ4D+fVy7kBuAbXGeV9SLNK5x3t7oEvHbP4v0DPojHIJSfvjwxJyUAotwqqeXW2ztna4EbRhu+Yg2W82nDgGURlw5PzcGeHRqT6AOhoCYu/CnpPB2oJdU6UW1rB6OLibPABSv/Epk0DERwor23tYDCCQQK64XgfAzmpgdGl0nUZsl0v5lWaBlQFpPDHXa1P+w== 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: Enable multigrain timestamps, which should ensure that there is an apparent change to the timestamp whenever it has been written after being actively observed via getattr. Beyond enabling the FS_MGTIME flag, this patch eliminates update_time_for_write, which goes to great pains to avoid in-memory stores. Just have it overwrite the timestamps unconditionally. Signed-off-by: Jeff Layton --- fs/btrfs/file.c | 25 ++++--------------------- fs/btrfs/super.c | 5 +++-- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 278a4ea651e1..321405bf788c 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1106,26 +1106,6 @@ void btrfs_check_nocow_unlock(struct btrfs_inode *inode) btrfs_drew_write_unlock(&inode->root->snapshot_lock); } -static void update_time_for_write(struct inode *inode) -{ - struct timespec64 now, ts; - - if (IS_NOCMTIME(inode)) - return; - - now = current_time(inode); - ts = inode_get_mtime(inode); - if (!timespec64_equal(&ts, &now)) - inode_set_mtime_to_ts(inode, now); - - ts = inode_get_ctime(inode); - if (!timespec64_equal(&ts, &now)) - inode_set_ctime_to_ts(inode, now); - - if (IS_I_VERSION(inode)) - inode_inc_iversion(inode); -} - static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from, size_t count) { @@ -1157,7 +1137,10 @@ static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from, * need to start yet another transaction to update the inode as we will * update the inode when we finish writing whatever data we write. */ - update_time_for_write(inode); + if (!IS_NOCMTIME(inode)) { + inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); + inode_inc_iversion(inode); + } start_pos = round_down(pos, fs_info->sectorsize); oldsize = i_size_read(inode); diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index f49e597e197f..570613bfd25f 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2154,7 +2154,7 @@ static struct file_system_type btrfs_fs_type = { .name = "btrfs", .mount = btrfs_mount, .kill_sb = btrfs_kill_super, - .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA, + .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_MGTIME, }; static struct file_system_type btrfs_root_fs_type = { @@ -2162,7 +2162,8 @@ static struct file_system_type btrfs_root_fs_type = { .name = "btrfs", .mount = btrfs_mount_root, .kill_sb = btrfs_kill_super, - .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP, + .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | + FS_ALLOW_IDMAP | FS_MGTIME, }; MODULE_ALIAS_FS("btrfs"); From patchwork Wed Oct 18 17:41:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13427583 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 E3A71CDB47E for ; Wed, 18 Oct 2023 17:42:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47E6A8D017F; Wed, 18 Oct 2023 13:41:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 42FD68D0016; Wed, 18 Oct 2023 13:41:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 258168D017F; Wed, 18 Oct 2023 13:41:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0E8788D0016 for ; Wed, 18 Oct 2023 13:41:57 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D957FB5EE2 for ; Wed, 18 Oct 2023 17:41:56 +0000 (UTC) X-FDA: 81359300232.22.BF8A6B6 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id 1C00020022 for ; Wed, 18 Oct 2023 17:41:54 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=G9KeDhGI; spf=pass (imf13.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=1697650915; 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:in-reply-to:references:references:dkim-signature; bh=ikpCApXB/qWFMOf6x0PCWwyfCqiC7EDQCruKexQ3Fwg=; b=qhjwi1Q/y0e8N2WqUo+cOiZbwd1ZIyKDk3L5bJskNWHwlYo/J0YEh2xpUKl4xyx1CQlZUW jBR+p7vurQ4kWYdRijTzne17b1k6tJIb8+Fs2SbjKAEgyeD4eaD7ZMHYKw0nAHl7Z4Jp6d cyEokoLERBkD7qffctevkAlDBYvO6cA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697650915; a=rsa-sha256; cv=none; b=MPdyweu5orqzemKGI4R9t0CC6euumn8N3TeL6XJZqiRyTYjuOBKNkHtc2FKZxHOh+ddJCA udC4yEZAVnRabqY0JfrKxH5dodENXDh4+TJStk8T2Vv5MyY9PYtcpSCDFsW/vNun8oYYTf yoyUZIOsok5gVZExSk4Kot+275jwnZ4= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=G9KeDhGI; spf=pass (imf13.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 (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4BB546189D; Wed, 18 Oct 2023 17:41:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1A73C43391; Wed, 18 Oct 2023 17:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697650914; bh=mMRFKHsg6CFW9vRC+qvje6I3FWhEbLE4To87FsaWYy0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=G9KeDhGIB9FCmXVvdb8/9fxs0Vl7HqKSxTG2hqRqWmfQABwQW7pdvKOVOXxt1vp/X 7jm9YEVYObd5mwPlrFkNtvsuTXR6xH5Pn13g+WIqWBU+hHOt+fTXPEXY0anLihyfPV N2lpWFc95eFiACPuWlr29oqQ7V4JvOv6Ls07DXNTG3JlEkbj2ZQ7xBoy5SYsS5A2bb DmhFjFozl3Zi+x494NzrmMrPjsGESKGON+RztxqNbwrZ3B7HJddhjWUFBZ8L06ONWC IAqsNdWapv9wZ06yAp7DwcwusRk/S8Fxe9ZUEw3SHPP3VJfZmT69ZHuZptBuaFgOVO uN/SIWObsbWYQ== From: Jeff Layton Date: Wed, 18 Oct 2023 13:41:16 -0400 Subject: [PATCH RFC 9/9] tmpfs: add support for multigrain timestamps MIME-Version: 1.0 Message-Id: <20231018-mgtime-v1-9-4a7a97b1f482@kernel.org> References: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> In-Reply-To: <20231018-mgtime-v1-0-4a7a97b1f482@kernel.org> To: Linus Torvalds , Alexander Viro , Christian Brauner , John Stultz , Thomas Gleixner , Stephen Boyd , Chandan Babu R , "Darrick J. Wong" , Dave Chinner , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Amir Goldstein , Jan Kara , David Howells Cc: linux-fsdevel@vger.kernel.org, linux-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, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=769; i=jlayton@kernel.org; h=from:subject:message-id; bh=mMRFKHsg6CFW9vRC+qvje6I3FWhEbLE4To87FsaWYy0=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlMBjJAuF/mn4fUKEE3uiFdGeHeVKOJDDMsX28Q t9B3mGYu2WJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZTAYyQAKCRAADmhBGVaC FXeLEADGWL+XVQBwiyFQFHvIPzldy2L8awb0YKPCr28SYeSR50oiPbqPzalc6MzF1KFc+NOvzOa 94PHr4jh1Zd5l44XOHvzRAdilY0BBloRQ6qVfnKJd5JmSQGB02a23Qs3Omp8vBldt+xaHk4I3+B PmOCDiBni6Dq8zr1G3M1S/Yu8FVgigl1nkDKRhaEJsogQyoid0JLsND7c43MLWfLm9RL8sEoiFQ 13PHXmfhUTbvhvCwucMjvlifITgBbUzgSxLMSUBINjfVazbERk48Dg/clacnw/Lxm9g0a/H8Dqi gf66uPXr54fnkhwrasliLB1kNNLISNBLVfOfLILNoHn5eDBcWVStIXYRT1dyX9qsbEUbwYpvIog 6k4DE3M+ZiqgvUilXZB1Yd4yiFTjZeMu3E3i3F4XS9ehA2ABL0L5Auyy4/JicO9FStbE5AUqREX u9ySpUplJrMTQ6yGu2XcHasRW703qajO8DORPB8u9DVDkVnoAto6RSwi2W3oGVoMMU7wpt5nhlo rwZLb5irBLYI25FjYy9jsDgdWSE818ID2KYoV9Dt/zjZj0akGxwQBs8aalDIMiw1aD+bQU8e5Qs t8fdVfGjIcSYqpBPVMMkbPB82S9hiajclrg18YKi7sr5wd0+90jWiGZf00jbQvf+BfnSXbG9aE4 IVTP54zf3BOAL2A== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: 1C00020022 X-Rspam-User: X-Stat-Signature: tsriob4kss7tcbmzjab3zkhyw1oh6rt4 X-Rspamd-Server: rspam03 X-HE-Tag: 1697650914-419800 X-HE-Meta: U2FsdGVkX19MkCMNUCCL7bMQccGg4+GcCUimTWUmt6z8RgfvfxvFEsHG8+PCnwsnhUMH+da2ECu7S8xGueaOHQI5kiOUcEFPB7EwWukdCnF2uWxBgry+gWdJVGJTWBiVOVW+K3pBY59YXEllZ5l2FHhIXSBrkOKfmZQDR2ovIxiBx/pLqr/EyWaSb29/04jksaoAB/06CT2smZxaX3wtg6eemPFzzv77XI/q8vj2m578F+U1Q0duMQsJYBV0rnhBVmV3kTAoMtJbuatrEzlRbw4cHF2t9adxYXaRVf2daSAUfr2BhMkA4Y1WPruWfNcp7A26ChtfYg7iTR7/JjJDmhIgfmONEkloBzVzJx5Z8KFQZBSX9l6PFx1RZk8BrifNjeuuYnsVjNHu+qljVFWEG/00GkiDwlfwkbHo2jPTB+5rvXgtiw+uZqn4yRsKdECEWzRUXHABW/dL8dLvbP/grOt5sAVFSPDkoWUj7S3Tsn0+XCej7lSW2bH5vyIhDrNSR4S4RTFeeiN9ZY4fqYyq5UHP8R5Ku5gPk7jVaSd7pUeQRuLLVq3Efs0RIz0frExU6BX3HGRURx2ETVe2Dl7hPpFqGN25A8O5B3vFlSwu0lW/ZWNcVVZGu9Zfa1pWzmFzI/Pgb4wGK/lGpw2O/z2bKTxg0Ht7a1WnsnFJBT0Gl2WaW29c9fiVdrqxRo9SGLRIRsbQnoojHi9NxfTM3eYker2LnglK9smrkpFoCZJrkP+ciwvhsrWzzU7Dk4Hsoxc0dkdAGhxj5qXBPPchdkl9wW9aWv+nN8Y+LqheSLC8T6Y/nJIQfLVQ1MsCZc6jCFdHbq4Smhy8Ku7RXdT34rj7DOQK8US0OWl55HFj+CYjEdPYT4eQrBDxYnzlluEByWI4OSXq2TcIdQvjjIIfaUvsAa7idAA4KF33l2n4AhZhSOlg3buQTh17tplg+uhGSYAmYZr8Gpl/80ruBds+poO WsxFD5e0 erUj3NYnQmtnZELR94ttE4tjIuM2oSP8BVP7Atiecfq9L3ByLlnu4A6HareVt3Ib/pJhGs7x2JQKH/W8xzAScJ9U+mKbbc+VnjMWTHcbItTUQjnLPkE6Wgt1qzFMEkN3q2KzCDGfPW/35CmkiEPByUdNxY4IiVJq7XZUrVjPyJQLHG1ShNunApx8lsUBU27bgRGuyYTOT3HwX8tdz/32SD+LK//1mNMfJAjqPNqUl/iT8R+uWZV3b6ed9YQ== 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: Enable multigrain timestamps, which should ensure that there is an apparent change to the timestamp whenever it has been written after being actively observed via getattr. tmpfs only requires the FS_MGTIME flag. Signed-off-by: Jeff Layton --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index c48239bfa646..6f5941bffa45 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4586,7 +4586,7 @@ static struct file_system_type shmem_fs_type = { #endif .kill_sb = kill_litter_super, #ifdef CONFIG_SHMEM - .fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP, + .fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP | FS_MGTIME, #else .fs_flags = FS_USERNS_MOUNT, #endif