From 46c360f9d38e0b26247a3b723545790853c6747b Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Sun, 27 Sep 2015 16:45:02 -0400 Subject: [PATCH] staging/lustre: use 64-bit inode timestamps internally Lustre has 64-bit timestamps in its network data structures, but on 32 bit systems, it converts them directly into time_t, which is 32 bit wide. This changes the code to use 64-bit time stamps for files. The Linux VFS code still uses time_t though, and will be changed in a separate patch series. Signed-off-by: Arnd Bergmann Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/cl_object.h | 6 +++--- drivers/staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 4 ++-- drivers/staging/lustre/lustre/llite/vvp_object.c | 12 ++++++------ drivers/staging/lustre/lustre/osc/osc_io.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 04dcb5111756..90fbaa22e510 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -173,11 +173,11 @@ struct cl_attr { */ loff_t cat_kms; /** Modification time. Measured in seconds since epoch. */ - time_t cat_mtime; + time64_t cat_mtime; /** Access time. Measured in seconds since epoch. */ - time_t cat_atime; + time64_t cat_atime; /** Change time. Measured in seconds since epoch. */ - time_t cat_ctime; + time64_t cat_ctime; /** * Blocks allocated to this cl_object on the server file system. * diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 37bf331be5c2..fdd0a58286c1 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -851,7 +851,7 @@ struct vvp_io { * Inode modification time that is checked across DLM * lock request. */ - time_t ft_mtime; + time64_t ft_mtime; struct vm_area_struct *ft_vma; /** * locked page returned from vvp_io diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 75a8ea21bc24..cf264de0e531 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -109,7 +109,7 @@ static int vvp_io_fault_iter_init(const struct lu_env *env, LASSERT(inode == file_inode(cl2ccc_io(env, ios)->cui_fd->fd_file)); - vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime); + vio->u.fault.ft_mtime = inode->i_mtime.tv_sec; return 0; } @@ -661,7 +661,7 @@ static int vvp_io_fault_start(const struct lu_env *env, pgoff_t last; /* last page in a file data region */ if (fio->ft_executable && - LTIME_S(inode->i_mtime) != vio->u.fault.ft_mtime) + inode->i_mtime.tv_sec != vio->u.fault.ft_mtime) CWARN("binary "DFID " changed while waiting for the page fault lock\n", PFID(lu_object_fid(&obj->co_lu))); diff --git a/drivers/staging/lustre/lustre/llite/vvp_object.c b/drivers/staging/lustre/lustre/llite/vvp_object.c index b6f6d4cb6e41..cb2811b9aae7 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_object.c +++ b/drivers/staging/lustre/lustre/llite/vvp_object.c @@ -87,9 +87,9 @@ static int vvp_attr_get(const struct lu_env *env, struct cl_object *obj, */ attr->cat_size = i_size_read(inode); - attr->cat_mtime = LTIME_S(inode->i_mtime); - attr->cat_atime = LTIME_S(inode->i_atime); - attr->cat_ctime = LTIME_S(inode->i_ctime); + attr->cat_mtime = inode->i_mtime.tv_sec; + attr->cat_atime = inode->i_atime.tv_sec; + attr->cat_ctime = inode->i_ctime.tv_sec; attr->cat_blocks = inode->i_blocks; attr->cat_uid = from_kuid(&init_user_ns, inode->i_uid); attr->cat_gid = from_kgid(&init_user_ns, inode->i_gid); @@ -107,11 +107,11 @@ static int vvp_attr_set(const struct lu_env *env, struct cl_object *obj, if (valid & CAT_GID) inode->i_gid = make_kgid(&init_user_ns, attr->cat_gid); if (valid & CAT_ATIME) - LTIME_S(inode->i_atime) = attr->cat_atime; + inode->i_atime.tv_sec = attr->cat_atime; if (valid & CAT_MTIME) - LTIME_S(inode->i_mtime) = attr->cat_mtime; + inode->i_mtime.tv_sec = attr->cat_mtime; if (valid & CAT_CTIME) - LTIME_S(inode->i_ctime) = attr->cat_ctime; + inode->i_ctime.tv_sec = attr->cat_ctime; if (0 && valid & CAT_SIZE) cl_isize_write_nolock(inode, attr->cat_size); /* not currently necessary */ diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index fa24e9ed1831..be058c289d76 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -518,7 +518,7 @@ static int osc_io_read_start(const struct lu_env *env, if (!slice->cis_io->ci_noatime) { cl_object_attr_lock(obj); - attr->cat_atime = LTIME_S(CURRENT_TIME); + attr->cat_atime = ktime_get_real_seconds(); rc = cl_object_attr_set(env, obj, attr, CAT_ATIME); cl_object_attr_unlock(obj); } @@ -534,7 +534,7 @@ static int osc_io_write_start(const struct lu_env *env, OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_SETTIME, 1); cl_object_attr_lock(obj); - attr->cat_mtime = attr->cat_ctime = LTIME_S(CURRENT_TIME); + attr->cat_mtime = attr->cat_ctime = ktime_get_real_seconds(); rc = cl_object_attr_set(env, obj, attr, CAT_MTIME | CAT_CTIME); cl_object_attr_unlock(obj); -- 2.34.1