aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ntfs/inode.c12
-rw-r--r--fs/ntfs/time.h27
2 files changed, 21 insertions, 18 deletions
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index decaf75d1cd5..bd3221cbdd95 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -667,18 +667,18 @@ static int ntfs_read_locked_inode(struct inode *vi)
667 * mtime is the last change of the data within the file. Not changed 667 * mtime is the last change of the data within the file. Not changed
668 * when only metadata is changed, e.g. a rename doesn't affect mtime. 668 * when only metadata is changed, e.g. a rename doesn't affect mtime.
669 */ 669 */
670 vi->i_mtime = timespec_to_timespec64(ntfs2utc(si->last_data_change_time)); 670 vi->i_mtime = ntfs2utc(si->last_data_change_time);
671 /* 671 /*
672 * ctime is the last change of the metadata of the file. This obviously 672 * ctime is the last change of the metadata of the file. This obviously
673 * always changes, when mtime is changed. ctime can be changed on its 673 * always changes, when mtime is changed. ctime can be changed on its
674 * own, mtime is then not changed, e.g. when a file is renamed. 674 * own, mtime is then not changed, e.g. when a file is renamed.
675 */ 675 */
676 vi->i_ctime = timespec_to_timespec64(ntfs2utc(si->last_mft_change_time)); 676 vi->i_ctime = ntfs2utc(si->last_mft_change_time);
677 /* 677 /*
678 * Last access to the data within the file. Not changed during a rename 678 * Last access to the data within the file. Not changed during a rename
679 * for example but changed whenever the file is written to. 679 * for example but changed whenever the file is written to.
680 */ 680 */
681 vi->i_atime = timespec_to_timespec64(ntfs2utc(si->last_access_time)); 681 vi->i_atime = ntfs2utc(si->last_access_time);
682 682
683 /* Find the attribute list attribute if present. */ 683 /* Find the attribute list attribute if present. */
684 ntfs_attr_reinit_search_ctx(ctx); 684 ntfs_attr_reinit_search_ctx(ctx);
@@ -2997,7 +2997,7 @@ int __ntfs_write_inode(struct inode *vi, int sync)
2997 si = (STANDARD_INFORMATION*)((u8*)ctx->attr + 2997 si = (STANDARD_INFORMATION*)((u8*)ctx->attr +
2998 le16_to_cpu(ctx->attr->data.resident.value_offset)); 2998 le16_to_cpu(ctx->attr->data.resident.value_offset));
2999 /* Update the access times if they have changed. */ 2999 /* Update the access times if they have changed. */
3000 nt = utc2ntfs(timespec64_to_timespec(vi->i_mtime)); 3000 nt = utc2ntfs(vi->i_mtime);
3001 if (si->last_data_change_time != nt) { 3001 if (si->last_data_change_time != nt) {
3002 ntfs_debug("Updating mtime for inode 0x%lx: old = 0x%llx, " 3002 ntfs_debug("Updating mtime for inode 0x%lx: old = 0x%llx, "
3003 "new = 0x%llx", vi->i_ino, (long long) 3003 "new = 0x%llx", vi->i_ino, (long long)
@@ -3006,7 +3006,7 @@ int __ntfs_write_inode(struct inode *vi, int sync)
3006 si->last_data_change_time = nt; 3006 si->last_data_change_time = nt;
3007 modified = true; 3007 modified = true;
3008 } 3008 }
3009 nt = utc2ntfs(timespec64_to_timespec(vi->i_ctime)); 3009 nt = utc2ntfs(vi->i_ctime);
3010 if (si->last_mft_change_time != nt) { 3010 if (si->last_mft_change_time != nt) {
3011 ntfs_debug("Updating ctime for inode 0x%lx: old = 0x%llx, " 3011 ntfs_debug("Updating ctime for inode 0x%lx: old = 0x%llx, "
3012 "new = 0x%llx", vi->i_ino, (long long) 3012 "new = 0x%llx", vi->i_ino, (long long)
@@ -3015,7 +3015,7 @@ int __ntfs_write_inode(struct inode *vi, int sync)
3015 si->last_mft_change_time = nt; 3015 si->last_mft_change_time = nt;
3016 modified = true; 3016 modified = true;
3017 } 3017 }
3018 nt = utc2ntfs(timespec64_to_timespec(vi->i_atime)); 3018 nt = utc2ntfs(vi->i_atime);
3019 if (si->last_access_time != nt) { 3019 if (si->last_access_time != nt) {
3020 ntfs_debug("Updating atime for inode 0x%lx: old = 0x%llx, " 3020 ntfs_debug("Updating atime for inode 0x%lx: old = 0x%llx, "
3021 "new = 0x%llx", vi->i_ino, 3021 "new = 0x%llx", vi->i_ino,
diff --git a/fs/ntfs/time.h b/fs/ntfs/time.h
index 01233989d5d1..24cd719f1fd2 100644
--- a/fs/ntfs/time.h
+++ b/fs/ntfs/time.h
@@ -36,16 +36,16 @@
36 * Convert the Linux UTC time @ts to its corresponding NTFS time and return 36 * Convert the Linux UTC time @ts to its corresponding NTFS time and return
37 * that in little endian format. 37 * that in little endian format.
38 * 38 *
39 * Linux stores time in a struct timespec consisting of a time_t (long at 39 * Linux stores time in a struct timespec64 consisting of a time64_t tv_sec
40 * present) tv_sec and a long tv_nsec where tv_sec is the number of 1-second 40 * and a long tv_nsec where tv_sec is the number of 1-second intervals since
41 * intervals since 1st January 1970, 00:00:00 UTC and tv_nsec is the number of 41 * 1st January 1970, 00:00:00 UTC and tv_nsec is the number of 1-nano-second
42 * 1-nano-second intervals since the value of tv_sec. 42 * intervals since the value of tv_sec.
43 * 43 *
44 * NTFS uses Microsoft's standard time format which is stored in a s64 and is 44 * NTFS uses Microsoft's standard time format which is stored in a s64 and is
45 * measured as the number of 100-nano-second intervals since 1st January 1601, 45 * measured as the number of 100-nano-second intervals since 1st January 1601,
46 * 00:00:00 UTC. 46 * 00:00:00 UTC.
47 */ 47 */
48static inline sle64 utc2ntfs(const struct timespec ts) 48static inline sle64 utc2ntfs(const struct timespec64 ts)
49{ 49{
50 /* 50 /*
51 * Convert the seconds to 100ns intervals, add the nano-seconds 51 * Convert the seconds to 100ns intervals, add the nano-seconds
@@ -63,7 +63,10 @@ static inline sle64 utc2ntfs(const struct timespec ts)
63 */ 63 */
64static inline sle64 get_current_ntfs_time(void) 64static inline sle64 get_current_ntfs_time(void)
65{ 65{
66 return utc2ntfs(current_kernel_time()); 66 struct timespec64 ts;
67
68 ktime_get_coarse_real_ts64(&ts);
69 return utc2ntfs(ts);
67} 70}
68 71
69/** 72/**
@@ -73,18 +76,18 @@ static inline sle64 get_current_ntfs_time(void)
73 * Convert the little endian NTFS time @time to its corresponding Linux UTC 76 * Convert the little endian NTFS time @time to its corresponding Linux UTC
74 * time and return that in cpu format. 77 * time and return that in cpu format.
75 * 78 *
76 * Linux stores time in a struct timespec consisting of a time_t (long at 79 * Linux stores time in a struct timespec64 consisting of a time64_t tv_sec
77 * present) tv_sec and a long tv_nsec where tv_sec is the number of 1-second 80 * and a long tv_nsec where tv_sec is the number of 1-second intervals since
78 * intervals since 1st January 1970, 00:00:00 UTC and tv_nsec is the number of 81 * 1st January 1970, 00:00:00 UTC and tv_nsec is the number of 1-nano-second
79 * 1-nano-second intervals since the value of tv_sec. 82 * intervals since the value of tv_sec.
80 * 83 *
81 * NTFS uses Microsoft's standard time format which is stored in a s64 and is 84 * NTFS uses Microsoft's standard time format which is stored in a s64 and is
82 * measured as the number of 100 nano-second intervals since 1st January 1601, 85 * measured as the number of 100 nano-second intervals since 1st January 1601,
83 * 00:00:00 UTC. 86 * 00:00:00 UTC.
84 */ 87 */
85static inline struct timespec ntfs2utc(const sle64 time) 88static inline struct timespec64 ntfs2utc(const sle64 time)
86{ 89{
87 struct timespec ts; 90 struct timespec64 ts;
88 91
89 /* Subtract the NTFS time offset. */ 92 /* Subtract the NTFS time offset. */
90 u64 t = (u64)(sle64_to_cpu(time) - NTFS_TIME_OFFSET); 93 u64 t = (u64)(sle64_to_cpu(time) - NTFS_TIME_OFFSET);