From faea09b8baa9efff7ce896f8ef5017575ef3994c Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 14 Nov 2023 13:27:31 +0100 Subject: [PATCH] Revert "xfs: switch to multigrain timestamps" Source kernel commit: f798accd5987dc2280e0ba9055edf1124af46a5f This reverts commit e44df2664746aed8b6dd5245eb711a0ce33c5cf5. Users reported regressions due to enabling multi-grained timestamps unconditionally. As no clear consensus on a solution has come up and the discussion has gone back to the drawing board revert the infrastructure changes for. If it isn't code that's here to stay, make it go away. Message-ID: <20230920-keine-eile-c9755b5825db@brauner> Acked-by: Jan Kara Acked-by: Jeff Layton Signed-off-by: Christian Brauner Signed-off-by: Carlos Maiolino --- include/xfs_inode.h | 10 +--------- libxfs/xfs_trans_inode.c | 6 +++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/include/xfs_inode.h b/include/xfs_inode.h index dd07d0f34..986815e5c 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -69,17 +69,9 @@ static inline void ihold(struct inode *inode) inode->i_count++; } -/* Userspace does not support multigrain timestamps incore. */ -#define I_CTIME_QUERIED (0) - static inline struct timespec64 inode_get_ctime(const struct inode *inode) { - struct timespec64 ctime; - - ctime.tv_sec = inode->__i_ctime.tv_sec; - ctime.tv_nsec = inode->__i_ctime.tv_nsec & ~I_CTIME_QUERIED; - - return ctime; + return inode->__i_ctime; } static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode, diff --git a/libxfs/xfs_trans_inode.c b/libxfs/xfs_trans_inode.c index 7a6ecb5db..ca8e82376 100644 --- a/libxfs/xfs_trans_inode.c +++ b/libxfs/xfs_trans_inode.c @@ -59,12 +59,12 @@ xfs_trans_ichgtime( ASSERT(tp); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); - /* If the mtime changes, then ctime must also change */ - ASSERT(flags & XFS_ICHGTIME_CHG); + tv = current_time(inode); - tv = inode_set_ctime_current(inode); if (flags & XFS_ICHGTIME_MOD) inode->i_mtime = tv; + if (flags & XFS_ICHGTIME_CHG) + inode_set_ctime_to_ts(inode, tv); if (flags & XFS_ICHGTIME_CREATE) ip->i_crtime = tv; } -- 2.47.2