From patchwork Thu Jul 13 23:00:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13312717 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 49D4EC001B0 for ; Thu, 13 Jul 2023 23:01:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7AB06B007D; Thu, 13 Jul 2023 19:01:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B2A828D0002; Thu, 13 Jul 2023 19:01:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A5006B0080; Thu, 13 Jul 2023 19:01:25 -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 8C1076B007D for ; Thu, 13 Jul 2023 19:01:25 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4FF521A03BB for ; Thu, 13 Jul 2023 23:01:25 +0000 (UTC) X-FDA: 81008111730.04.DD27CB1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id 86BFF40028 for ; Thu, 13 Jul 2023 23:01:23 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=B0VXtoar; spf=pass (imf17.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=1689289283; a=rsa-sha256; cv=none; b=pGO0v5kVxNDg9UdGLfZikyMWR/k6WqXg/Cz6Cnb/qgC3EBkJ9wycxVTzkPnqOABmYE1HXj wO7RZmU30EEx49fL9hvxLqTPshwWFS+X4mlytenSRm5+5qL82QIdpWBQF7PAwx1tWTxsee 66maelwqJjJKj2BbXpecqAPYLR4hxM4= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=B0VXtoar; spf=pass (imf17.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=1689289283; 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=B/0oagySbS3Ifk2UJ6Hmx4LuRWkoKIToXNE7lkONKcc=; b=ByruLmwrmOiyuRyOtxm4am+AdYeUwYJ1+oXW6O6r7wgEWHFHEkE8JfB/GFomtDL4BGfG5z 4pigesAqGUX6o4q++k1IIOV+SJKOKI/T/y/q7kzx63GdO7uYdNrr/NvREbJ3YeLUP+Myh9 XVm+nFjhBnLzH49f/F+2LPzIxY7QK0E= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7D8C461AD2; Thu, 13 Jul 2023 23:01:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB019C433B6; Thu, 13 Jul 2023 23:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689289281; bh=Dy0ObexSdjvGFnE5GNrBxiftdRymvhQ5lbJx72BKffY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=B0VXtoarm7to3z75jta+r86rymInA0rcOZXXK6PDKyjttw0yeeQ9Oa/YGe0WPfeLw Aqagg2qZGm2iD6O77zF6UEpGttkdBeZ1KtYNAK7yCsHmbrkDzuuzwIxPLcP4GO43wI w39CalEOT65TGDELmucNcEdz39fGNSEIdSWn3pWnfkNQrJywJdCraylNm9TttY5Jra pGZ/outKj00jmCqSJqFF6+vMYT/UgsykUhifnnNjDCMaq/UK/yjZqJD95sei8IkN69 Yjpg4lSMArs8ujYS9j9CZbgze6idfR5gLc5rQLXioEN5xsUXGMQdyyJnSBdudTqHOd n9mfYLATGMhVA== From: Jeff Layton Date: Thu, 13 Jul 2023 19:00:51 -0400 Subject: [PATCH v5 2/8] fs: add infrastructure for multigrain timestamps MIME-Version: 1.0 Message-Id: <20230713-mgctime-v5-2-9eb795d2ae37@kernel.org> References: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> In-Reply-To: <20230713-mgctime-v5-0-9eb795d2ae37@kernel.org> To: Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Chris Mason , Josef Bacik , David Sterba , Xiubo Li , Ilya Dryomov , Jan Harkes , coda@cs.cmu.edu, Tyler Hicks , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Namjae Jeon , Sungjong Seo , Jan Kara , Theodore Ts'o , Andreas Dilger , Jaegeuk Kim , OGAWA Hirofumi , Miklos Szeredi , Bob Peterson , Andreas Gruenbacher , Greg Kroah-Hartman , Tejun Heo , Alexander Viro , Christian Brauner , Trond Myklebust , Anna Schumaker , Konstantin Komarov , Mark Fasheh , Joel Becker , Joseph Qi , Mike Marshall , Martin Brandenburg , Luis Chamberlain , Kees Cook , Iurii Zaikin , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Sergey Senozhatsky , Richard Weinberger , Hans de Goede , Hugh Dickins , Andrew Morton , "Darrick J. Wong" Cc: Dave Chinner , v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@coda.cs.cmu.edu, ecryptfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-mtd@lists.infradead.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=12090; i=jlayton@kernel.org; h=from:subject:message-id; bh=Dy0ObexSdjvGFnE5GNrBxiftdRymvhQ5lbJx72BKffY=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBksIIuQ6/aMqdFkrW889tZd28XDGD/NKP3ZyaCk jSGPEQm+rOJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZLCCLgAKCRAADmhBGVaC Fa3EEACPAYF/UdPqY2NWkaVzk8H/NAcHUW/hPvIS9vjNZruwFmXFj/LYyMvcp0tofMwLRgMcCAE Vph+wO/c807cLy5llDvTlTm0TjzPef3az0VN3Q8Gzb/2Nnh81yJnaQqOzRwFI1Dobw4ieNMzoU6 4toolNwW0tdDD7IU/urQP+4n7wFZT9iHmcto7q5Ef6rFla5COdzyRUSOPKFltzFKgjBiF2ZUbi1 9rPgV9imtCZWp7fH8mkRIVmoRaIrx24GtSlBnp/pBU+0KzjVNXDvvnegezzxutC4fSPJuW2h5pZ PiakxgsAa14RATd/5YXrIc+yNNZfeC0pRUmGgHOGL10njpjBp7Vo0nCcxoKc1I2kDO9N0tnniRi QyijUzdhFi4tOGbKQFjGi7GTuQekgkvLj3T2CiHuUcXH4phso83iPzj97egR0thkirGb6Cvv/CY uy76MlvwYeCIYaBQkk7dZtQOpLjIjI239VoHsf8OgmrImV9FVxAoJ4yB0PhSCnXl1crVKzEUphQ eemlORwSpndKSNmSnOacohNIRXM4Mqzq1NZM/oJVsRkcHkTc2M6q3C/agLX+m3kKOnc5xOjo8Cm Oq7V4ramHqhM83+/svEq1p6QVyO5KLsFUjSv20Q208e+yhCjvDrQ7s4NNP/Yqb8o/hZn8Clw7W2 cnsnAuyIF+Bo72A== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 86BFF40028 X-Stat-Signature: xmwstw3thqt1crubkc67frbnra3xfoj9 X-Rspam-User: X-HE-Tag: 1689289283-851362 X-HE-Meta: U2FsdGVkX1/ELBA46IhxNJ0Ie/ZILA/Dv1G8PG//q6CRy9Kg3h+lvbz+4pK4zUWKp44pcS9dpDHhDnhSO/ncFYVHDdl64mrVqkP8b6d/hUFDHsCggHevDBRPS3xafQQrnHQ+T/c2EtKTvApPy+qpOd4/aaeavT+B9LlBR6Ha9E7BgPnQh18jfoNfBGESKIjdAhKAmPxVKwMTMA8TIcQhYitSS5rlF5M0IZbmq8wAI5jQoW+GsuccJHEDv881STz4wVufDjPGNZLA/86fmKjALLnWr+yKxUDbITVhz0FrVPn1r3pJJKYOscR7rhRN0PD9eSD0TzHaxpGtU24iBjitESm+LNJ2Vk0W7SLUtcCFUY1nC091LuA8YSmYR6mu8O0FV2aV6ucJrnFHbHpjSxonbNBhxfPXV6EjYiZaJLctznw4KO0yBvfdsqctpF8OsH81ihtTeUeCN47cnMCKGniobPVxQYjBQ0oIxtMsEu+wGOJJagOH0RQL42D3FYH2OJowoCuFNMqlO3JW7lFvxhh8ohwXkM1NAcyLzR8EJxJ5P1Qk9KnDgL5W5f6+rrX3IHm5DSdZvCMgTDZJXoik82CEnIhMhb51uWECHIpbhZvP3VHKqEce6PfWvzhoOYflc6GEQBmWNXGKFtB8/p45P5fFJI2ksxT9vQ+HEuByUZ2W2nNx03HlsZVjG6BwPr4uH1SF69WOrh2F7KP69z0HQKRnq1QLNUpB1OFoKUt0blMDx3EfazJY+/clzVbv9mF9EW49vp6pj/s6ngCepM6QXn8JXoFTrQon7UYMYEWTg1F3SCoJaKInaZYjntCmQn8+DHgNPn6pxw46MZG48DTOee6oFt56SvzN7KVjBeNwrh//bIBz7kJTSOXzg3cI2P6AAwD1yl42qhC7iGPi5GSgJS2eWp8pnrt6EXwQ454D3N2xClcP+C5bskADV5JmwusV1VA1jj4BlyPwwZ5QT2FxCkg 8cJx+LYX xkuY/aTFs/Q8gwMig32V0WH+p3epj8Ef9cwOfiBZhWfUIs0r6tPwyKjm/BYexAXXRGlxuEOtqZS+FkaIv1i88kMv7UKUiV6C35BPCyE9tGIXBO+/4aNk60FQzl4wK5tZu5gfn59anecDj0rK/4+78EEftwbcfNBR3AffJf1oao/ypD8yczQHD5g1TA+FPFcjlSkGWkbQCfejtJXFt+PXiGH7e66nufBC0L9VubytkGCCc1+qCXrHLQpQcomGwdS6k22PnTkgmsJMPCZkVWUAjD23jSUCrCWORiCTs0HbUo8nkBkr22jl9wB5aXY+vz9aHOnRBIN9yqcEVSut5uPgvlJ8jtnnwyYh/WLlT 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 | 98 ++++++++++++++++++++++++++++++++++++++---------------- fs/stat.c | 41 +++++++++++++++++++++-- include/linux/fs.h | 45 +++++++++++++++++++++++-- 3 files changed, 151 insertions(+), 33 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index d4ab92233062..369621e7faf5 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1919,6 +1919,21 @@ int inode_update_time(struct inode *inode, struct timespec64 *time, int flags) } EXPORT_SYMBOL(inode_update_time); +/** + * current_coarse_time - Return FS time + * @inode: inode. + * + * Return the current coarse-grained time truncated to the time + * granularity supported by the fs. + */ +static struct timespec64 current_coarse_time(struct inode *inode) +{ + struct timespec64 now; + + ktime_get_coarse_real_ts64(&now); + return timestamp_truncate(now, inode); +} + /** * atime_needs_update - update the access time * @path: the &struct path to update @@ -1952,7 +1967,7 @@ bool atime_needs_update(const struct path *path, struct inode *inode) if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)) return false; - now = current_time(inode); + now = current_coarse_time(inode); if (!relatime_need_update(mnt, inode, now)) return false; @@ -1986,7 +2001,7 @@ void touch_atime(const struct path *path) * We may also fail on filesystems that have the ability to make parts * of the fs read only, e.g. subvolumes in Btrfs. */ - now = current_time(inode); + now = current_coarse_time(inode); inode_update_time(inode, &now, S_ATIME); __mnt_drop_write(mnt); skip_update: @@ -2072,6 +2087,56 @@ 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 ctime/mtime change. If the ctime is flagged + * as having been QUERIED, get a fine-grained timestamp. + */ +static struct timespec64 current_mgtime(struct inode *inode) +{ + struct timespec64 now; + atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec; + long nsec = atomic_long_read(pnsec); + + if (nsec & I_CTIME_QUERIED) { + ktime_get_real_ts64(&now); + } else { + struct timespec64 ctime; + + ktime_get_coarse_real_ts64(&now); + + /* + * If we've recently fetched a fine-grained timestamp + * then the coarse-grained one may still be earlier than the + * existing one. Just keep the existing ctime if so. + */ + ctime = inode_get_ctime(inode); + if (timespec64_compare(&ctime, &now) > 0) + now = ctime; + } + + return timestamp_truncate(now, inode); +} + +/** + * current_time - Return timestamp suitable for ctime update + * @inode: inode to eventually be updated + * + * Return the current time, which is usually coarse-grained but may be fine + * grained if the filesystem uses multigrain timestamps and the existing + * ctime was queried since the last update. + */ +struct timespec64 current_time(struct inode *inode) +{ + if (is_mgtime(inode)) + return current_mgtime(inode); + return current_coarse_time(inode); +} +EXPORT_SYMBOL(current_time); + static int inode_needs_update_time(struct inode *inode, struct timespec64 *now) { int sync_it = 0; @@ -2480,37 +2545,12 @@ struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode) } EXPORT_SYMBOL(timestamp_truncate); -/** - * current_time - Return FS time - * @inode: inode. - * - * Return the current time truncated to the time granularity supported by - * the fs. - * - * Note that inode and inode->sb cannot be NULL. - * Otherwise, the function warns and returns time without truncation. - */ -struct timespec64 current_time(struct inode *inode) -{ - struct timespec64 now; - - ktime_get_coarse_real_ts64(&now); - - if (unlikely(!inode->i_sb)) { - WARN(1, "current_time() called with uninitialized super_block in the inode"); - return now; - } - - return timestamp_truncate(now, inode); -} -EXPORT_SYMBOL(current_time); - /** * inode_set_ctime_current - set the ctime to current_time * @inode: inode * - * Set the inode->i_ctime to the current value for the inode. Returns - * the current value that was assigned to i_ctime. + * Set the inode->__i_ctime to the current value for the inode. Returns + * the current value that was assigned to __i_ctime. */ struct timespec64 inode_set_ctime_current(struct inode *inode) { diff --git a/fs/stat.c b/fs/stat.c index 062f311b5386..51effd1c2bc2 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 + * @request_mask: STATX_* values requested + * @inode: inode from which to grab the c/mtime + * @stat: where to store the resulting values + * + * 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(u32 request_mask, struct inode *inode, struct kstat *stat) +{ + atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_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->i_mtime; + stat->ctime.tv_sec = inode->__i_ctime.tv_sec; + /* + * Atomically set the QUERIED flag and fetch the new value with + * the flag masked off. + */ + stat->ctime.tv_nsec = atomic_long_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->i_atime; - stat->mtime = inode->i_mtime; - stat->ctime = inode_get_ctime(inode); + + if (is_mgtime(inode)) { + fill_mg_cmtime(request_mask, inode, stat); + } else { + stat->mtime = inode->i_mtime; + 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 42d1434cc427..a0bdbefbf293 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1477,15 +1477,43 @@ 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) + /** * inode_get_ctime - fetch the current ctime from the inode * @inode: inode from which to fetch ctime * - * Grab the current ctime from the inode and return it. + * Grab the current ctime tv_nsec field from the inode, mask off the + * I_CTIME_QUERIED flag and return it. This is mostly intended for use by + * internal consumers of the ctime that aren't concerned with ensuring a + * fine-grained update on the next change (e.g. when preparing to store + * the value in the backing store for later retrieval). + * + * This is safe to call regardless of whether the underlying filesystem + * is using multigrain timestamps. */ static inline struct timespec64 inode_get_ctime(const struct inode *inode) { - return inode->__i_ctime; + struct timespec64 ctime; + + ctime.tv_sec = inode->__i_ctime.tv_sec; + ctime.tv_nsec = inode->__i_ctime.tv_nsec & ~I_CTIME_QUERIED; + + return ctime; } /** @@ -2261,6 +2289,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; @@ -2284,6 +2313,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)); @@ -2919,6 +2959,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(u32 request_mask, struct inode *inode, struct kstat *stat); 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);