]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Linux 4.18 compat: inode timespec -> timespec64
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 20 Jun 2018 04:51:18 +0000 (21:51 -0700)
committerGitHub <noreply@github.com>
Wed, 20 Jun 2018 04:51:18 +0000 (21:51 -0700)
Commit torvalds/linux@95582b0 changes the inode i_atime, i_mtime,
and i_ctime members form timespec's to timespec64's to make them
2038 safe.  As part of this change the current_time() function was
also updated to return the timespec64 type.

Resolve this issue by introducing a new inode_timespec_t type which
is defined to match the timespec type used by the inode.  It should
be used when working with inode timestamps to ensure matching types.

The timestruc_t type under Illumos was used in a similar fashion but
was specified to always be a timespec_t.  Rather than incorrectly
define this type all timespec_t types have been replaced by the new
inode_timespec_t type.

Finally, the kernel and user space 'sys/time.h' headers were aligned
with each other.  They define as appropriate for the context several
constants as macros and include static inline implementation of
gethrestime(), gethrestime_sec(), and gethrtime().

Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #7643

27 files changed:
config/kernel-current-time.m4
config/kernel-inode-times.m4 [new file with mode: 0644]
config/kernel.m4
include/spl/sys/condvar.h
include/spl/sys/time.h
include/spl/sys/types.h
include/spl/sys/vnode.h
include/sys/dmu.h
include/sys/dmu_objset.h
include/sys/dsl_dir.h
include/sys/spa_impl.h
include/sys/xvattr.h
include/sys/zfs_context.h
include/sys/zfs_znode.h
include/sys/zpl.h
lib/libspl/Makefile.am
lib/libspl/gethrestime.c [deleted file]
lib/libspl/gethrtime.c [deleted file]
lib/libspl/include/sys/time.h
lib/libzpool/kernel.c
module/zfs/dmu_objset.c
module/zfs/dsl_dir.c
module/zfs/fm.c
module/zfs/zfs_ctldir.c
module/zfs/zfs_vnops.c
module/zfs/zfs_znode.c
module/zfs/zpl_inode.c

index 2ede9ff38c4165a1c8d1708ac61878e9ae701af3..c7d5c9b52006da39cf493afb58e663da885eca17 100644 (file)
@@ -1,15 +1,14 @@
 dnl #
 dnl # 4.9, current_time() added
+dnl # 4.18, return type changed from timespec to timespec64
 dnl #
 AC_DEFUN([ZFS_AC_KERNEL_CURRENT_TIME],
        [AC_MSG_CHECKING([whether current_time() exists])
        ZFS_LINUX_TRY_COMPILE_SYMBOL([
                #include <linux/fs.h>
        ], [
-               struct inode ip;
-               struct timespec now __attribute__ ((unused));
-
-               now = current_time(&ip);
+               struct inode ip __attribute__ ((unused));
+               ip.i_atime = current_time(&ip);
        ], [current_time], [fs/inode.c], [
                AC_MSG_RESULT(yes)
                AC_DEFINE(HAVE_CURRENT_TIME, 1, [current_time() exists])
diff --git a/config/kernel-inode-times.m4 b/config/kernel-inode-times.m4
new file mode 100644 (file)
index 0000000..f581841
--- /dev/null
@@ -0,0 +1,25 @@
+dnl #
+dnl # 4.18 API change
+dnl # i_atime, i_mtime, and i_ctime changed from timespec to timespec64.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
+       AC_MSG_CHECKING([whether inode->i_*time's are timespec64])
+       tmp_flags="$EXTRA_KCFLAGS"
+       EXTRA_KCFLAGS="-Werror"
+       ZFS_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+       ],[
+               struct inode ip;
+               struct timespec ts;
+
+               memset(&ip, 0, sizeof(ip));
+               ts = ip.i_mtime;
+       ],[
+               AC_MSG_RESULT(no)
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_INODE_TIMESPEC64_TIMES, 1,
+                   [inode->i_*time's are timespec64])
+       ])
+       EXTRA_KCFLAGS="$tmp_flags"
+])
index d5b69d68260e3a6d177aafc0c62833f51fcb96b8..8c2998204cde867fb6256c4c847c63ad38791b4e 100644 (file)
@@ -31,6 +31,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL_WAIT_ON_BIT
        ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T
        ZFS_AC_KERNEL_WAIT_QUEUE_HEAD_ENTRY
+       ZFS_AC_KERNEL_INODE_TIMES
        ZFS_AC_KERNEL_INODE_LOCK
        ZFS_AC_KERNEL_GROUP_INFO_GID
        ZFS_AC_KERNEL_WRITE
index 1d47cdd967f2ef74d05380f06bbd72278598eb86..28caea57181cd401df2ec4169387a24289f3e965 100644 (file)
@@ -30,6 +30,7 @@
 #include <sys/mutex.h>
 #include <sys/callo.h>
 #include <sys/wait.h>
+#include <sys/time.h>
 
 /*
  * The kcondvar_t struct is protected by mutex taken externally before
index d6aaca913fe518bcbfcde896666275c44fce1a2e..14d3ec2c916b8fdd87008519c8ec307eabe489a6 100644 (file)
 
 static const int hz = HZ;
 
+typedef longlong_t             hrtime_t;
+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
+
 static inline void
-gethrestime(timestruc_t *now)
+gethrestime(inode_timespec_t *ts)
 {
-       *now = current_kernel_time();
+#if defined(HAVE_INODE_TIMESPEC64_TIMES)
+       *ts = current_kernel_time64();
+#else
+       *ts = current_kernel_time();
+#endif
 }
 
 static inline time_t
@@ -74,9 +87,9 @@ gethrestime_sec(void)
 static inline hrtime_t
 gethrtime(void)
 {
-       struct timespec now;
-       getrawmonotonic(&now);
-       return (((hrtime_t)now.tv_sec * NSEC_PER_SEC) + now.tv_nsec);
+       struct timespec ts;
+       getrawmonotonic(&ts);
+       return (((hrtime_t)ts.tv_sec * NSEC_PER_SEC) + ts.tv_nsec);
 }
 
 #endif  /* _SPL_TIME_H */
index 3bb3ed3e25efe4dff5cdb6fe2227c29170a70dd5..483e3675152a943bff56a2a72749fc2527df381d 100644 (file)
@@ -53,10 +53,6 @@ typedef unsigned long long   rlim64_t;
 typedef struct task_struct     kthread_t;
 typedef struct task_struct     proc_t;
 
-typedef struct timespec                timestruc_t;
-typedef struct timespec                timespec_t;
-typedef longlong_t             hrtime_t;
-
 typedef int                    id_t;
 typedef short                  pri_t;
 typedef short                  index_t;
index d3b903f13a570d24100e1273cea8fa308ca132e1..2c038a6d291b4b6885f767f6570d13550544ee08 100644 (file)
@@ -128,9 +128,9 @@ typedef struct vattr {
        long            va_nodeid;      /* node # */
        uint32_t        va_nlink;       /* # links */
        uint64_t        va_size;        /* file size */
-       struct timespec va_atime;       /* last acc */
-       struct timespec va_mtime;       /* last mod */
-       struct timespec va_ctime;       /* last chg */
+       inode_timespec_t va_atime;      /* last acc */
+       inode_timespec_t va_mtime;      /* last mod */
+       inode_timespec_t va_ctime;      /* last chg */
        dev_t           va_rdev;        /* dev */
        uint64_t        va_nblocks;     /* space used */
        uint32_t        va_blksize;     /* block size */
index 44c026286dd2dfc6a78e37af2e70c7c877609cb0..45259a7fc5472249307354253b544d2330915dbe 100644 (file)
@@ -962,7 +962,7 @@ uint64_t dmu_objset_fsid_guid(objset_t *os);
 /*
  * Get the [cm]time for an objset's snapshot dir
  */
-timestruc_t dmu_objset_snap_cmtime(objset_t *os);
+inode_timespec_t dmu_objset_snap_cmtime(objset_t *os);
 
 int dmu_objset_is_snapshot(objset_t *os);
 
index 57872d8db8d34bd8d6094df8e4787014d9ba5dd3..fa032ba2b2cdc8fbd4fc4bbcb09fb1fbcbfa133b 100644 (file)
@@ -211,7 +211,7 @@ int dmu_objset_find_dp(struct dsl_pool *dp, uint64_t ddobj,
     int func(struct dsl_pool *, struct dsl_dataset *, void *),
     void *arg, int flags);
 void dmu_objset_evict_dbufs(objset_t *os);
-timestruc_t dmu_objset_snap_cmtime(objset_t *os);
+inode_timespec_t dmu_objset_snap_cmtime(objset_t *os);
 
 /* called from dsl */
 void dmu_objset_sync(objset_t *os, zio_t *zio, dmu_tx_t *tx);
index 58d243885bb9fe860eb5a6f6d286301d3f4bd4ac..8a346e902dc84aa342c10d3636ba0b95ee0b582c 100644 (file)
@@ -108,7 +108,7 @@ struct dsl_dir {
        /* Protected by dd_lock */
        kmutex_t dd_lock;
        list_t dd_props; /* list of dsl_prop_record_t's */
-       timestruc_t dd_snap_cmtime; /* last time snapshot namespace changed */
+       inode_timespec_t dd_snap_cmtime; /* last snapshot namespace change */
        uint64_t dd_origin_txg;
 
        /* gross estimate of space used by in-flight tx's */
@@ -180,7 +180,7 @@ boolean_t dsl_dir_is_clone(dsl_dir_t *dd);
 void dsl_dir_new_refreservation(dsl_dir_t *dd, struct dsl_dataset *ds,
     uint64_t reservation, cred_t *cr, dmu_tx_t *tx);
 void dsl_dir_snap_cmtime_update(dsl_dir_t *dd);
-timestruc_t dsl_dir_snap_cmtime(dsl_dir_t *dd);
+inode_timespec_t dsl_dir_snap_cmtime(dsl_dir_t *dd);
 void dsl_dir_set_reservation_sync_impl(dsl_dir_t *dd, uint64_t value,
     dmu_tx_t *tx);
 void dsl_dir_zapify(dsl_dir_t *dd, dmu_tx_t *tx);
index cd214c29c0b615b83fca7cace33d6a9a244879ea..6abb631577fca6f90eaa9d83b0930d7f61780dc3 100644 (file)
@@ -224,7 +224,7 @@ struct spa {
        uint64_t        spa_freeze_txg;         /* freeze pool at this txg */
        uint64_t        spa_load_max_txg;       /* best initial ub_txg */
        uint64_t        spa_claim_max_txg;      /* highest claimed birth txg */
-       timespec_t      spa_loaded_ts;          /* 1st successful open time */
+       inode_timespec_t spa_loaded_ts;         /* 1st successful open time */
        objset_t        *spa_meta_objset;       /* copy of dp->dp_meta_objset */
        kmutex_t        spa_evicting_os_lock;   /* Evicting objset list lock */
        list_t          spa_evicting_os_list;   /* Objsets being evicted. */
index 68610c496b1410ca466e882dbfeed07922e05875..0463bdfbc9d8c70e983dcfe67618a22783e87d5b 100644 (file)
@@ -48,7 +48,7 @@
  * Structure of all optional attributes.
  */
 typedef struct xoptattr {
-       timestruc_t     xoa_createtime; /* Create time of file */
+       inode_timespec_t xoa_createtime;        /* Create time of file */
        uint8_t         xoa_archive;
        uint8_t         xoa_system;
        uint8_t         xoa_readonly;
index 31a72ba70c86ca04612a76ccf0c40a2f341ecde2..6f502897ec18bedb9ad35c4687c2c61b7d733dec 100644 (file)
@@ -483,7 +483,7 @@ extern char *vn_dumpdir;
 #define        AV_SCANSTAMP_SZ 32              /* length of anti-virus scanstamp */
 
 typedef struct xoptattr {
-       timestruc_t     xoa_createtime; /* Create time of file */
+       inode_timespec_t xoa_createtime;        /* Create time of file */
        uint8_t         xoa_archive;
        uint8_t         xoa_system;
        uint8_t         xoa_readonly;
@@ -596,13 +596,6 @@ extern void delay(clock_t ticks);
 #define        USEC_TO_TICK(usec)      ((usec) / (MICROSEC / hz))
 #define        NSEC_TO_TICK(usec)      ((usec) / (NANOSEC / hz))
 
-#define        gethrestime_sec() time(NULL)
-#define        gethrestime(t) \
-       do {\
-               (t)->tv_sec = gethrestime_sec();\
-               (t)->tv_nsec = 0;\
-       } while (0);
-
 #define        max_ncpus       64
 #define        boot_ncpus      (sysconf(_SC_NPROCESSORS_ONLN))
 
index 3f2bd1fbb149110bad862b3df3a16f3a9ff76f08..a34d2453263ddf5eb8dab0c1945ffdef466703ec 100644 (file)
@@ -291,19 +291,36 @@ zfs_inherit_projid(znode_t *dzp)
 
 extern unsigned int zfs_object_mutex_size;
 
-/* Encode ZFS stored time values from a struct timespec */
+/*
+ * Encode ZFS stored time values from a struct timespec / struct timespec64.
+ */
 #define        ZFS_TIME_ENCODE(tp, stmp)               \
-{                                              \
+do {                                           \
        (stmp)[0] = (uint64_t)(tp)->tv_sec;     \
        (stmp)[1] = (uint64_t)(tp)->tv_nsec;    \
-}
+} while (0)
 
-/* Decode ZFS stored time values to a struct timespec */
+#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)               \
-{                                              \
-       (tp)->tv_sec = (time_t)(stmp)[0];               \
-       (tp)->tv_nsec = (long)(stmp)[1];                \
-}
+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 */
 
 /*
  * Timestamp defines
index 5df7bd1ac9c6e77dbdb0473d3e07a3331f6153ae..2766269f31c8650e20bb0a7032a98e3696b1346a 100644 (file)
@@ -188,4 +188,13 @@ zpl_dir_emit_dots(struct file *file, zpl_dir_context_t *ctx)
 }
 #endif /* HAVE_VFS_ITERATE */
 
+/*
+ * Linux 4.18, inode times converted from timespec to timespec64.
+ */
+#if defined(HAVE_INODE_TIMESPEC64_TIMES)
+#define        zpl_inode_timespec_trunc(ts, gran)      timespec64_trunc(ts, gran)
+#else
+#define        zpl_inode_timespec_trunc(ts, gran)      timespec_trunc(ts, gran)
+#endif
+
 #endif /* _SYS_ZPL_H */
index e4512700a86aea22727a696eaf8cbe731c588aa0..b7fa795d56005c04ba5eff1a8c6e999f6711bde2 100644 (file)
@@ -18,8 +18,6 @@ noinst_LTLIBRARIES = libspl.la
 USER_C = \
        getexecname.c \
        gethostid.c \
-       gethrtime.c \
-       gethrestime.c \
        getmntany.c \
        list.c \
        mkdirp.c \
diff --git a/lib/libspl/gethrestime.c b/lib/libspl/gethrestime.c
deleted file mode 100644 (file)
index d37cc2d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#include <time.h>
-#include <sys/time.h>
-
-void
-gethrestime(timestruc_t *ts)
-{
-       struct timeval tv;
-
-       gettimeofday(&tv, NULL);
-       ts->tv_sec = tv.tv_sec;
-       ts->tv_nsec = tv.tv_usec * NSEC_PER_USEC;
-}
diff --git a/lib/libspl/gethrtime.c b/lib/libspl/gethrtime.c
deleted file mode 100644 (file)
index 95ceb18..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#include <time.h>
-#include <sys/time.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-hrtime_t
-gethrtime(void)
-{
-       struct timespec ts;
-       int rc;
-
-       rc = clock_gettime(CLOCK_MONOTONIC, &ts);
-       if (rc) {
-               fprintf(stderr, "Error: clock_gettime() = %d\n", rc);
-               abort();
-       }
-
-       return ((((u_int64_t)ts.tv_sec) * NANOSEC) + ts.tv_nsec);
-}
index b3dd74dd5715b850bc8e7f28fd9f813f030ab7ad..291f2190a28c3d2516ecb90345678576169a49ff 100644 (file)
@@ -27,8 +27,9 @@
 #ifndef _LIBSPL_SYS_TIME_H
 #define        _LIBSPL_SYS_TIME_H
 
-#include_next <sys/time.h>
+#include <time.h>
 #include <sys/types.h>
+#include_next <sys/time.h>
 
 #ifndef SEC
 #define        SEC             1
 #define        SEC2NSEC(m)     ((hrtime_t)(m) * (NANOSEC / SEC))
 #endif
 
-
 typedef        long long               hrtime_t;
-typedef        struct  timespec        timestruc_t;
-typedef        struct  timespec        timespec_t;
-
-
-extern hrtime_t gethrtime(void);
-extern void gethrestime(timestruc_t *);
+typedef        struct timespec         timespec_t;
+typedef struct timespec                inode_timespec_t;
+
+static inline void
+gethrestime(inode_timespec_t *ts)
+{
+       struct timeval tv;
+       (void) gettimeofday(&tv, NULL);
+       ts->tv_sec = tv.tv_sec;
+       ts->tv_nsec = tv.tv_usec * NSEC_PER_USEC;
+}
+
+static inline time_t
+gethrestime_sec(void)
+{
+       struct timeval tv;
+       (void) gettimeofday(&tv, NULL);
+       return (tv.tv_sec);
+}
+
+static inline hrtime_t
+gethrtime(void)
+{
+       struct timespec ts;
+       (void) clock_gettime(CLOCK_MONOTONIC, &ts);
+       return ((((u_int64_t)ts.tv_sec) * NANOSEC) + ts.tv_nsec);
+}
 
 #endif /* _LIBSPL_SYS_TIME_H */
index f3e84975c6db6eeb0341ca8189b136a1ce1f3b43..1eaa51b9f86eaf127543a182f4666864a37b1a03 100644 (file)
@@ -344,7 +344,7 @@ cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime)
 {
        int error;
        struct timeval tv;
-       timestruc_t ts;
+       struct timespec ts;
        clock_t delta;
 
        delta = abstime - ddi_get_lbolt();
@@ -379,7 +379,7 @@ cv_timedwait_hires(kcondvar_t *cv, kmutex_t *mp, hrtime_t tim, hrtime_t res,
 {
        int error;
        struct timeval tv;
-       timestruc_t ts;
+       struct timespec ts;
        hrtime_t delta;
 
        ASSERT(flag == 0 || flag == CALLOUT_FLAG_ABSOLUTE);
index 92de370573414c729fa66e00553208c10195a621..445f63e5d4671a4e1de69fbf782e999437ecb0ac 100644 (file)
@@ -965,7 +965,7 @@ dmu_objset_evict_done(objset_t *os)
        kmem_free(os, sizeof (objset_t));
 }
 
-timestruc_t
+inode_timespec_t
 dmu_objset_snap_cmtime(objset_t *os)
 {
        return (dsl_dir_snap_cmtime(os->os_dsl_dataset->ds_dir));
index 4b85208d87e92ff951801a8d3370905024de5455..36abfe0241b046c6f822a8a5d631cf1d92b8bdeb 100644 (file)
@@ -2126,10 +2126,10 @@ dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd,
        return (0);
 }
 
-timestruc_t
+inode_timespec_t
 dsl_dir_snap_cmtime(dsl_dir_t *dd)
 {
-       timestruc_t t;
+       inode_timespec_t t;
 
        mutex_enter(&dd->dd_lock);
        t = dd->dd_snap_cmtime;
@@ -2141,7 +2141,7 @@ dsl_dir_snap_cmtime(dsl_dir_t *dd)
 void
 dsl_dir_snap_cmtime_update(dsl_dir_t *dd)
 {
-       timestruc_t t;
+       inode_timespec_t t;
 
        gethrestime(&t);
        mutex_enter(&dd->dd_lock);
index 5c30066700cc9a5d8b80d5cc5fd24965f42e47d9..4986a3fa23501442f71677367f44252e629ff9e1 100644 (file)
@@ -503,8 +503,8 @@ zfs_zevent_insert(zevent_t *ev)
 int
 zfs_zevent_post(nvlist_t *nvl, nvlist_t *detector, zevent_cb_t *cb)
 {
+       inode_timespec_t tv;
        int64_t tv_array[2];
-       timestruc_t tv;
        uint64_t eid;
        size_t nvl_size = 0;
        zevent_t *ev;
index f0720e58a12cbbd3548a684a22d0ed389ee33d78..baa72863e68ef1cea97f93b655c449d13a05b39c 100644 (file)
@@ -448,7 +448,7 @@ static struct inode *
 zfsctl_inode_alloc(zfsvfs_t *zfsvfs, uint64_t id,
     const struct file_operations *fops, const struct inode_operations *ops)
 {
-       struct timespec now;
+       inode_timespec_t now;
        struct inode *ip;
        znode_t *zp;
 
index 832e4bfc9b612d856c4f55440376d23d1d8375c5..35bbd884b9762676a34c1375542af73fc2c71bfc 100644 (file)
@@ -3408,7 +3408,7 @@ top:
 
        if (mask & (ATTR_MTIME | ATTR_SIZE)) {
                ZFS_TIME_ENCODE(&vap->va_mtime, mtime);
-               ZTOI(zp)->i_mtime = timespec_trunc(vap->va_mtime,
+               ZTOI(zp)->i_mtime = zpl_inode_timespec_trunc(vap->va_mtime,
                    ZTOI(zp)->i_sb->s_time_gran);
 
                SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL,
@@ -3417,7 +3417,7 @@ top:
 
        if (mask & (ATTR_CTIME | ATTR_SIZE)) {
                ZFS_TIME_ENCODE(&vap->va_ctime, ctime);
-               ZTOI(zp)->i_ctime = timespec_trunc(vap->va_ctime,
+               ZTOI(zp)->i_ctime = zpl_inode_timespec_trunc(vap->va_ctime,
                    ZTOI(zp)->i_sb->s_time_gran);
                SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL,
                    ctime, sizeof (ctime));
index bb18c1b9a35afbea407344130e664a140d4cd1aa..f037d4c967cdc1260d02db67268ea41ef4d71048 100644 (file)
@@ -698,7 +698,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
        uint64_t        rdev = 0;
        zfsvfs_t        *zfsvfs = ZTOZSB(dzp);
        dmu_buf_t       *db;
-       timestruc_t     now;
+       inode_timespec_t now;
        uint64_t        gen, obj;
        int             bonuslen;
        int             dnodesize;
@@ -1403,7 +1403,7 @@ void
 zfs_tstamp_update_setup(znode_t *zp, uint_t flag, uint64_t mtime[2],
     uint64_t ctime[2])
 {
-       timestruc_t     now;
+       inode_timespec_t now;
 
        gethrestime(&now);
 
index 3b5643d09177944ed80f877605e6ca0f91bf55bb..41b91cabcb9689a428843175043a5c7e70063b05 100644 (file)
@@ -384,9 +384,10 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
        vap->va_mtime = ia->ia_mtime;
        vap->va_ctime = ia->ia_ctime;
 
-       if (vap->va_mask & ATTR_ATIME)
-               ip->i_atime = timespec_trunc(ia->ia_atime,
+       if (vap->va_mask & ATTR_ATIME) {
+               ip->i_atime = zpl_inode_timespec_trunc(ia->ia_atime,
                    ip->i_sb->s_time_gran);
+       }
 
        cookie = spl_fstrans_mark();
        error = -zfs_setattr(ip, vap, 0, cr);