As part of the y2038 changes:
timespec64_trunc was added in kernel 4.17
inode i_Xtime values are timespec64 in kernel 4.18
timespec_trunc was removed in kernel 4.19
Harden the existing LC_INODE_TIMESPEC64 check and stop
using the deprecated timespec_trunc().
oti_time is set but never used, remove oti_time.
Linux-commit:
8efd6894ff089adeeac7cb9f32125b85d963d1bc
Linux-commit:
95582b00838837fc07e042979320caf917ce3fe6
Linux-commit:
976516404ff3fab2a8caa8bd6f5efc1437fed0b8
Test-Parameters: trivial
Change-Id: Idadbf6ddd9aedbd251d7bbbb5b1486d4aa757ac5
Signed-off-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-on: https://review.whamcloud.com/35050
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
#
# LC_INODE_TIMESPEC64
#
#
# LC_INODE_TIMESPEC64
#
+# kernel 4.17-rc7 commit 8efd6894ff089adeeac7cb9f32125b85d963d1bc
+# fs: add timespec64_truncate()
# kernel 4.18 commit 95582b00838837fc07e042979320caf917ce3fe6
# inode timestamps switched to timespec64
# kernel 4.18 commit 95582b00838837fc07e042979320caf917ce3fe6
# inode timestamps switched to timespec64
+# kernel 4.19-rc2 commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8
+# y2038: remove unused time interfaces
+# ...
+# timespec_trunc
+# ...
+# When inode times are timespec64 stop using the deprecated
+# time interfaces.
#
AC_DEFUN([LC_INODE_TIMESPEC64], [
#
AC_DEFUN([LC_INODE_TIMESPEC64], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
LB_CHECK_COMPILE([if inode timestamps are struct timespec64],
inode_timespec64, [
#include <linux/fs.h>
LB_CHECK_COMPILE([if inode timestamps are struct timespec64],
inode_timespec64, [
#include <linux/fs.h>
struct inode inode = {};
struct timespec64 ts = {};
struct inode inode = {};
struct timespec64 ts = {};
+ inode.i_atime = timespec64_trunc(ts, 1);
+ (void)inode;
],[
AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
[inode times are using timespec64])
])
],[
AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
[inode times are using timespec64])
])
+EXTRA_KCFLAGS="$tmp_flags"
]) # LC_INODE_TIMESPEC64
#
]) # LC_INODE_TIMESPEC64
#
return obj->oo_owner == env;
}
return obj->oo_owner == env;
}
-#ifdef HAVE_INODE_TIMESPEC64
-static struct timespec64 osd_inode_time(const struct lu_env *env,
- struct inode *inode, __u64 seconds)
-#else
-static struct timespec osd_inode_time(const struct lu_env *env,
- struct inode *inode, __u64 seconds)
-#endif
-{
- struct osd_thread_info *oti = osd_oti_get(env);
- struct timespec *t = &oti->oti_time;
-
- t->tv_sec = seconds;
- t->tv_nsec = 0;
- *t = timespec_trunc(*t, inode->i_sb->s_time_gran);
-#ifdef HAVE_INODE_TIMESPEC64
- return timespec_to_timespec64(*t);
-#else
- return *t;
-#endif
-}
-
static void osd_inode_getattr(const struct lu_env *env,
struct inode *inode, struct lu_attr *attr)
{
static void osd_inode_getattr(const struct lu_env *env,
struct inode *inode, struct lu_attr *attr)
{
return 0;
if (bits & LA_ATIME)
return 0;
if (bits & LA_ATIME)
- inode->i_atime = osd_inode_time(env, inode, attr->la_atime);
+ inode->i_atime = osd_inode_time(inode, attr->la_atime);
- inode->i_ctime = osd_inode_time(env, inode, attr->la_ctime);
+ inode->i_ctime = osd_inode_time(inode, attr->la_ctime);
- inode->i_mtime = osd_inode_time(env, inode, attr->la_mtime);
+ inode->i_mtime = osd_inode_time(inode, attr->la_mtime);
if (bits & LA_SIZE) {
spin_lock(&inode->i_lock);
LDISKFS_I(inode)->i_disksize = attr->la_size;
if (bits & LA_SIZE) {
spin_lock(&inode->i_lock);
LDISKFS_I(inode)->i_disksize = attr->la_size;
unsigned int dr_init_at; /* the line iobuf was initialized */
};
unsigned int dr_init_at; /* the line iobuf was initialized */
};
+#ifdef HAVE_INODE_TIMESPEC64
+# define osd_timespec timespec64
+# define osd_timespec_trunc(ts, gran) timespec64_trunc((ts), (gran))
+#else
+# define osd_timespec timespec
+# define osd_timespec_trunc(ts, gran) timespec_trunc((ts), (gran))
+#endif
+
+static inline struct osd_timespec osd_inode_time(struct inode *inode,
+ s64 seconds)
+{
+ struct osd_timespec ts = { .tv_sec = seconds };
+
+ return osd_timespec_trunc(ts, inode->i_sb->s_time_gran);
+}
+
#define OSD_INS_CACHE_SIZE 8
struct osd_thread_info {
#define OSD_INS_CACHE_SIZE 8
struct osd_thread_info {
struct osd_inode_id oti_id3;
struct ost_id oti_ostid;
struct osd_inode_id oti_id3;
struct ost_id oti_ostid;
- /*
- * XXX temporary: for ->i_op calls.
- */
- struct timespec oti_time;
-
/**
* following ipd and it structures are used for osd_index_iam_lookup()
* these are defined separately as we might do index operation
/**
* following ipd and it structures are used for osd_index_iam_lookup()
* these are defined separately as we might do index operation
const struct lu_env *oti_env;
struct lu_fid oti_fid;
const struct lu_env *oti_env;
struct lu_fid oti_fid;
- /*
- * XXX temporary: for ->i_op calls.
- */
- struct timespec oti_time;