config: remove HAVE_INODE_TIMESPEC64_TIMES

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #16479
This commit is contained in:
Rob Norris 2024-08-24 20:41:49 +10:00 committed by Brian Behlendorf
parent 06c34465b7
commit 80d7f0f98e
5 changed files with 3 additions and 63 deletions

View File

@ -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 <linux/fs.h>
],[
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)

View File

@ -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);
}

View File

@ -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)

View File

@ -160,12 +160,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)

View File

@ -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)