aboutsummaryrefslogtreecommitdiffstats
path: root/fs/orangefs
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-02-26 07:54:10 -0500
committerMike Marshall <hubcap@omnibond.com>2016-02-26 10:18:39 -0500
commitbe81ce48b262e2164d64a1354c618571b0c9cd09 (patch)
tree7a87804479823af766d1595c76392501e745490a /fs/orangefs
parent69a23de2f3de046f1017489eb9e6de4e8165e4f0 (diff)
orangefs: avoid time conversion function
The new orangefs code uses a helper function to read a time field to its private structures from struct iattr. This will conflict with the move to 64-bit timestamps in the kernel and is generally not necessary. This replaces the conversion with a simple cast to time64_t that shows what is going on. As the orangefs-internal representation already uses 64-bit timestamps, there should be no ambiguity to negative values, and the cast ensures that we treat them as times before 1970 on both 32-bit and 64-bit architectures, rather than times after 2038. This patch keeps that behavior. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs')
-rw-r--r--fs/orangefs/orangefs-kernel.h5
-rw-r--r--fs/orangefs/orangefs-utils.c12
2 files changed, 5 insertions, 12 deletions
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index 785c9a4ef834..b6f52e3fee7f 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -555,11 +555,6 @@ int orangefs_unmount_sb(struct super_block *sb);
555 555
556bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op); 556bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op);
557 557
558static inline __u64 orangefs_convert_time_field(const struct timespec *ts)
559{
560 return (__u64)ts->tv_sec;
561}
562
563int orangefs_normalize_to_errno(__s32 error_code); 558int orangefs_normalize_to_errno(__s32 error_code);
564 559
565extern struct mutex devreq_mutex; 560extern struct mutex devreq_mutex;
diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c
index 488f3501b09c..8ef9e9646748 100644
--- a/fs/orangefs/orangefs-utils.c
+++ b/fs/orangefs/orangefs-utils.c
@@ -202,9 +202,9 @@ static int copy_attributes_to_inode(struct inode *inode,
202 202
203 inode->i_uid = make_kuid(&init_user_ns, attrs->owner); 203 inode->i_uid = make_kuid(&init_user_ns, attrs->owner);
204 inode->i_gid = make_kgid(&init_user_ns, attrs->group); 204 inode->i_gid = make_kgid(&init_user_ns, attrs->group);
205 inode->i_atime.tv_sec = (time_t) attrs->atime; 205 inode->i_atime.tv_sec = (time64_t) attrs->atime;
206 inode->i_mtime.tv_sec = (time_t) attrs->mtime; 206 inode->i_mtime.tv_sec = (time64_t) attrs->mtime;
207 inode->i_ctime.tv_sec = (time_t) attrs->ctime; 207 inode->i_ctime.tv_sec = (time64_t) attrs->ctime;
208 inode->i_atime.tv_nsec = 0; 208 inode->i_atime.tv_nsec = 0;
209 inode->i_mtime.tv_nsec = 0; 209 inode->i_mtime.tv_nsec = 0;
210 inode->i_ctime.tv_nsec = 0; 210 inode->i_ctime.tv_nsec = 0;
@@ -301,16 +301,14 @@ static inline int copy_attributes_from_inode(struct inode *inode,
301 if (iattr->ia_valid & ATTR_ATIME) { 301 if (iattr->ia_valid & ATTR_ATIME) {
302 attrs->mask |= ORANGEFS_ATTR_SYS_ATIME; 302 attrs->mask |= ORANGEFS_ATTR_SYS_ATIME;
303 if (iattr->ia_valid & ATTR_ATIME_SET) { 303 if (iattr->ia_valid & ATTR_ATIME_SET) {
304 attrs->atime = 304 attrs->atime = (time64_t)iattr->ia_atime.tv_sec;
305 orangefs_convert_time_field(&iattr->ia_atime);
306 attrs->mask |= ORANGEFS_ATTR_SYS_ATIME_SET; 305 attrs->mask |= ORANGEFS_ATTR_SYS_ATIME_SET;
307 } 306 }
308 } 307 }
309 if (iattr->ia_valid & ATTR_MTIME) { 308 if (iattr->ia_valid & ATTR_MTIME) {
310 attrs->mask |= ORANGEFS_ATTR_SYS_MTIME; 309 attrs->mask |= ORANGEFS_ATTR_SYS_MTIME;
311 if (iattr->ia_valid & ATTR_MTIME_SET) { 310 if (iattr->ia_valid & ATTR_MTIME_SET) {
312 attrs->mtime = 311 attrs->mtime = (time64_t)iattr->ia_mtime.tv_sec;
313 orangefs_convert_time_field(&iattr->ia_mtime);
314 attrs->mask |= ORANGEFS_ATTR_SYS_MTIME_SET; 312 attrs->mask |= ORANGEFS_ATTR_SYS_MTIME_SET;
315 } 313 }
316 } 314 }