[RFC 16/32] ntfs: convert to struct inode_time

From: Arnd Bergmann
Date: Fri May 30 2014 - 16:15:52 EST


ntfs uses 64-bit integers for inode timestamps, which will work
thousands of years, but the VFS uses struct timespec for timestamps,
which is only good until 2038 on 32-bit CPUs.

This gets us one small step closer to lifting the VFS limit by using
struct inode_time in ntfs.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Anton Altaparmakov <anton@xxxxxxxxxx>
Cc: linux-ntfs-dev@xxxxxxxxxxxxxxxxxxxxx
---
fs/ntfs/inode.c | 12 ++++++------
fs/ntfs/time.h | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index f47af5e..8f7cba5 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -2811,11 +2811,11 @@ done:
* for real.
*/
if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) {
- struct timespec now = current_fs_time(VFS_I(base_ni)->i_sb);
+ struct inode_time now = current_fs_time(VFS_I(base_ni)->i_sb);
int sync_it = 0;

- if (!timespec_equal(&VFS_I(base_ni)->i_mtime, &now) ||
- !timespec_equal(&VFS_I(base_ni)->i_ctime, &now))
+ if (!inode_time_equal(&VFS_I(base_ni)->i_mtime, &now) ||
+ !inode_time_equal(&VFS_I(base_ni)->i_ctime, &now))
sync_it = 1;
VFS_I(base_ni)->i_mtime = now;
VFS_I(base_ni)->i_ctime = now;
@@ -2930,13 +2930,13 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
}
}
if (ia_valid & ATTR_ATIME)
- vi->i_atime = timespec_trunc(attr->ia_atime,
+ vi->i_atime = inode_time_trunc(attr->ia_atime,
vi->i_sb->s_time_gran);
if (ia_valid & ATTR_MTIME)
- vi->i_mtime = timespec_trunc(attr->ia_mtime,
+ vi->i_mtime = inode_time_trunc(attr->ia_mtime,
vi->i_sb->s_time_gran);
if (ia_valid & ATTR_CTIME)
- vi->i_ctime = timespec_trunc(attr->ia_ctime,
+ vi->i_ctime = inode_time_trunc(attr->ia_ctime,
vi->i_sb->s_time_gran);
mark_inode_dirty(vi);
out:
diff --git a/fs/ntfs/time.h b/fs/ntfs/time.h
index 0123398..2c8d325 100644
--- a/fs/ntfs/time.h
+++ b/fs/ntfs/time.h
@@ -45,7 +45,7 @@
* measured as the number of 100-nano-second intervals since 1st January 1601,
* 00:00:00 UTC.
*/
-static inline sle64 utc2ntfs(const struct timespec ts)
+static inline sle64 utc2ntfs(const struct inode_time ts)
{
/*
* Convert the seconds to 100ns intervals, add the nano-seconds
@@ -63,7 +63,7 @@ static inline sle64 utc2ntfs(const struct timespec ts)
*/
static inline sle64 get_current_ntfs_time(void)
{
- return utc2ntfs(current_kernel_time());
+ return utc2ntfs(CURRENT_TIME);
}

/**
@@ -82,9 +82,9 @@ static inline sle64 get_current_ntfs_time(void)
* measured as the number of 100 nano-second intervals since 1st January 1601,
* 00:00:00 UTC.
*/
-static inline struct timespec ntfs2utc(const sle64 time)
+static inline struct inode_time ntfs2utc(const sle64 time)
{
- struct timespec ts;
+ struct inode_time ts;

/* Subtract the NTFS time offset. */
u64 t = (u64)(sle64_to_cpu(time) - NTFS_TIME_OFFSET);
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/