diff --git a/config/kernel-inode-times.m4 b/config/kernel-inode-times.m4 index 4d861596e..59988e937 100644 --- a/config/kernel-inode-times.m4 +++ b/config/kernel-inode-times.m4 @@ -14,20 +14,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_TIMES], [ ts = timestamp_truncate(ts, &ip); ]) - dnl # - dnl # 4.18 API change - dnl # i_atime, i_mtime, and i_ctime changed from timespec to timespec64. - dnl # - ZFS_LINUX_TEST_SRC([inode_times], [ - #include - ],[ - struct inode ip; - struct timespec ts; - - memset(&ip, 0, sizeof(ip)); - ts = ip.i_mtime; - ]) - dnl # dnl # 6.6 API change dnl # i_ctime no longer directly accessible, must use @@ -106,15 +92,6 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [ AC_MSG_RESULT(no) ]) - AC_MSG_CHECKING([whether inode->i_*time's are timespec64]) - ZFS_LINUX_TEST_RESULT([inode_times], [ - AC_MSG_RESULT(no) - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_INODE_TIMESPEC64_TIMES, 1, - [inode->i_*time's are timespec64]) - ]) - AC_MSG_CHECKING([whether inode_get_ctime() exists]) ZFS_LINUX_TEST_RESULT([inode_get_ctime], [ AC_MSG_RESULT(yes) diff --git a/include/os/linux/spl/sys/time.h b/include/os/linux/spl/sys/time.h index fec85f8b8..2b3363c1c 100644 --- a/include/os/linux/spl/sys/time.h +++ b/include/os/linux/spl/sys/time.h @@ -59,11 +59,7 @@ typedef struct timespec timespec_t; #define TIMESPEC_OVERFLOW(ts) \ ((ts)->tv_sec < TIME_MIN || (ts)->tv_sec > TIME_MAX) -#if defined(HAVE_INODE_TIMESPEC64_TIMES) typedef struct timespec64 inode_timespec_t; -#else -typedef struct timespec inode_timespec_t; -#endif /* Include for Lustre compatibility */ #define timestruc_t inode_timespec_t @@ -71,33 +67,22 @@ typedef struct timespec inode_timespec_t; static inline void gethrestime(inode_timespec_t *ts) { -#if defined(HAVE_INODE_TIMESPEC64_TIMES) - #if defined(HAVE_KTIME_GET_COARSE_REAL_TS64) ktime_get_coarse_real_ts64(ts); #else *ts = current_kernel_time64(); #endif /* HAVE_KTIME_GET_COARSE_REAL_TS64 */ - -#else - *ts = current_kernel_time(); -#endif } static inline uint64_t gethrestime_sec(void) { -#if defined(HAVE_INODE_TIMESPEC64_TIMES) #if defined(HAVE_KTIME_GET_COARSE_REAL_TS64) inode_timespec_t ts; ktime_get_coarse_real_ts64(&ts); #else inode_timespec_t ts = current_kernel_time64(); #endif /* HAVE_KTIME_GET_COARSE_REAL_TS64 */ - -#else - inode_timespec_t ts = current_kernel_time(); -#endif return (ts.tv_sec); } diff --git a/include/os/linux/zfs/sys/zfs_znode_impl.h b/include/os/linux/zfs/sys/zfs_znode_impl.h index 65928757d..2d456452f 100644 --- a/include/os/linux/zfs/sys/zfs_znode_impl.h +++ b/include/os/linux/zfs/sys/zfs_znode_impl.h @@ -141,27 +141,14 @@ do { \ (stmp)[1] = (uint64_t)(tp)->tv_nsec; \ } while (0) -#if defined(HAVE_INODE_TIMESPEC64_TIMES) /* * Decode ZFS stored time values to a struct timespec64 - * 4.18 and newer kernels. */ #define ZFS_TIME_DECODE(tp, stmp) \ do { \ (tp)->tv_sec = (time64_t)(stmp)[0]; \ (tp)->tv_nsec = (long)(stmp)[1]; \ } while (0) -#else -/* - * Decode ZFS stored time values to a struct timespec - * 4.17 and older kernels. - */ -#define ZFS_TIME_DECODE(tp, stmp) \ -do { \ - (tp)->tv_sec = (time_t)(stmp)[0]; \ - (tp)->tv_nsec = (long)(stmp)[1]; \ -} while (0) -#endif /* HAVE_INODE_TIMESPEC64_TIMES */ #define ZFS_ACCESSTIME_STAMP(zfsvfs, zp) diff --git a/include/os/linux/zfs/sys/zpl.h b/include/os/linux/zfs/sys/zpl.h index 8ac459ead..fb56a93d2 100644 --- a/include/os/linux/zfs/sys/zpl.h +++ b/include/os/linux/zfs/sys/zpl.h @@ -161,12 +161,9 @@ extern long zpl_ioctl_fideduperange(struct file *filp, void *arg); #if defined(HAVE_INODE_TIMESTAMP_TRUNCATE) #define zpl_inode_timestamp_truncate(ts, ip) timestamp_truncate(ts, ip) -#elif defined(HAVE_INODE_TIMESPEC64_TIMES) -#define zpl_inode_timestamp_truncate(ts, ip) \ - timespec64_trunc(ts, (ip)->i_sb->s_time_gran) #else #define zpl_inode_timestamp_truncate(ts, ip) \ - timespec_trunc(ts, (ip)->i_sb->s_time_gran) + timespec64_trunc(ts, (ip)->i_sb->s_time_gran) #endif #if defined(HAVE_INODE_OWNER_OR_CAPABLE) diff --git a/module/os/linux/zfs/zfs_znode.c b/module/os/linux/zfs/zfs_znode.c index 8b0011c37..4d18187b7 100644 --- a/module/os/linux/zfs/zfs_znode.c +++ b/module/os/linux/zfs/zfs_znode.c @@ -1363,12 +1363,6 @@ zfs_zinactive(znode_t *zp) zfs_znode_hold_exit(zfsvfs, zh); } -#if defined(HAVE_INODE_TIMESPEC64_TIMES) -#define zfs_compare_timespec timespec64_compare -#else -#define zfs_compare_timespec timespec_compare -#endif - /* * Determine whether the znode's atime must be updated. The logic mostly * duplicates the Linux kernel's relatime_need_update() functionality. @@ -1388,11 +1382,11 @@ zfs_relatime_need_update(const struct inode *ip) * has passed since the last update of atime. */ tmp_ts = zpl_inode_get_mtime(ip); - if (zfs_compare_timespec(&tmp_ts, &tmp_atime) >= 0) + if (timespec64_compare(&tmp_ts, &tmp_atime) >= 0) return (B_TRUE); tmp_ts = zpl_inode_get_ctime(ip); - if (zfs_compare_timespec(&tmp_ts, &tmp_atime) >= 0) + if (timespec64_compare(&tmp_ts, &tmp_atime) >= 0) return (B_TRUE); if ((hrtime_t)now.tv_sec - (hrtime_t)tmp_atime.tv_sec >= 24*60*60)