From 99415423ae769ae75c3257bf6d2357f81bceb2d3 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 13 Nov 2025 14:17:37 -0800 Subject: [PATCH] Remove timespec64 compat for el7 Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 --------- kmod/src/data.c | 2 +- kmod/src/dir.c | 4 ++-- kmod/src/inode.h | 2 +- kmod/src/kernelcompat.c | 30 ------------------------------ kmod/src/kernelcompat.h | 9 --------- 6 files changed, 4 insertions(+), 52 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index b6223568..ddd89eef 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -6,15 +6,6 @@ ccflags-y += -include $(src)/kernelcompat.h -# -# v4.17-rc6-7-g95582b008388 -# -# Kernel has current_time(inode) to uniformly retreive timespec in the right unit -# -ifneq (,$(shell grep 'struct timespec64 current_time' include/linux/fs.h)) -ccflags-y += -DKC_CURRENT_TIME_INODE=1 -endif - # # v4.9-12228-g530e9b76ae8f # diff --git a/kmod/src/data.c b/kmod/src/data.c index 65c07f01..27d528b0 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -1268,7 +1268,7 @@ int scoutfs_data_move_blocks(struct inode *from, u64 from_off, struct data_ext_args from_args; struct data_ext_args to_args; struct scoutfs_extent ext; - struct kc_timespec cur_time; + struct timespec64 cur_time; LIST_HEAD(locks); bool done = false; loff_t from_size; diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 59fd00aa..993bb3a7 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -952,7 +952,7 @@ static int scoutfs_unlink(struct inode *dir, struct dentry *dentry) { struct super_block *sb = dir->i_sb; struct inode *inode = dentry->d_inode; - struct kc_timespec ts = current_time(inode); + struct timespec64 ts = current_time(inode); struct scoutfs_lock *inode_lock = NULL; struct scoutfs_lock *orph_lock = NULL; struct scoutfs_lock *dir_lock = NULL; @@ -1625,7 +1625,7 @@ static int scoutfs_rename_common(KC_VFS_NS_DEF struct scoutfs_lock *orph_lock = NULL; struct scoutfs_dirent new_dent; struct scoutfs_dirent old_dent; - struct kc_timespec now; + struct timespec64 now; bool ins_new = false; bool del_new = false; bool ins_old = false; diff --git a/kmod/src/inode.h b/kmod/src/inode.h index fcead8fb..b5d57802 100644 --- a/kmod/src/inode.h +++ b/kmod/src/inode.h @@ -23,7 +23,7 @@ struct scoutfs_inode_info { u64 offline_blocks; u64 proj; u32 flags; - struct kc_timespec crtime; + struct timespec64 crtime; /* * Protects per-inode extent items, most particularly readers diff --git a/kmod/src/kernelcompat.c b/kmod/src/kernelcompat.c index 851d5e1a..f36a4a6a 100644 --- a/kmod/src/kernelcompat.c +++ b/kmod/src/kernelcompat.c @@ -4,36 +4,6 @@ #include "kernelcompat.h" -#ifndef KC_CURRENT_TIME_INODE -struct timespec64 kc_current_time(struct inode *inode) -{ - struct timespec64 now; - unsigned gran; - - getnstimeofday64(&now); - - if (unlikely(!inode->i_sb)) { - WARN(1, "current_time() called with uninitialized super_block in the inode"); - return now; - } - - gran = inode->i_sb->s_time_gran; - - /* Avoid division in the common cases 1 ns and 1 s. */ - if (gran == 1) { - /* nothing */ - } else if (gran == NSEC_PER_SEC) { - now.tv_nsec = 0; - } else if (gran > 1 && gran < NSEC_PER_SEC) { - now.tv_nsec -= now.tv_nsec % gran; - } else { - WARN(1, "illegal file time granularity: %u", gran); - } - - return now; -} -#endif - #ifndef KC_GENERIC_FILE_BUFFERED_WRITE ssize_t kc_generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 94d87893..58f90754 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -25,15 +25,6 @@ #define SB_I_VERSION MS_I_VERSION #endif -#ifndef KC_CURRENT_TIME_INODE -struct timespec64 kc_current_time(struct inode *inode); -#define current_time kc_current_time -#define kc_timespec timespec -#else -#define kc_timespec timespec64 -#endif - - #define KC_DEFINE_SHRINKER(name) struct shrinker name #define KC_INIT_SHRINKER_FUNCS(name, countfn, scanfn) do { \ __typeof__(name) _shrink = (name); \