diff mbox

[RFC,v2a,08/12] fs: btrfs: Change timespec data types to use vfs_time

Message ID 1455269766-2994-9-git-send-email-deepa.kernel@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Deepa Dinamani Feb. 12, 2016, 9:36 a.m. UTC
The VFS inode timestamps are not y2038 safe as they use
struct timespec. These will be changed to use struct timespec64
instead and that is y2038 safe.
But, since the above data type conversion will break the end
file systems, use vfs_time aliases here to access inode times.
The following needs to switch along with vfs time
representation.

1. inode times set/get.
2. For inode times comparison.
3. getting times from current_fs_time()

btrfs_timespec already uses 64 bits to represent seconds in timestamps.
The switch to 64 bit using vfs_time will allow for timestamps beyond
2038 to be represented corretly.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
 fs/btrfs/file.c        | 6 +++---
 fs/btrfs/ioctl.c       | 4 ++--
 fs/btrfs/root-tree.c   | 2 +-
 fs/btrfs/transaction.c | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 610f569..f7d1e14 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1732,16 +1732,16 @@  out:
 
 static void update_time_for_write(struct inode *inode)
 {
-	struct timespec now;
+	struct vfs_time now;
 
 	if (IS_NOCMTIME(inode))
 		return;
 
 	now = current_fs_time(inode->i_sb);
-	if (!timespec_equal(&inode->i_mtime, &now))
+	if (!vfs_time_equal(&inode->i_mtime, &now))
 		inode->i_mtime = now;
 
-	if (!timespec_equal(&inode->i_ctime, &now))
+	if (!vfs_time_equal(&inode->i_ctime, &now))
 		inode->i_ctime = now;
 
 	if (IS_I_VERSION(inode))
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 6f35d9c..471037f 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -443,7 +443,7 @@  static noinline int create_subvol(struct inode *dir,
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct btrfs_root *new_root;
 	struct btrfs_block_rsv block_rsv;
-	struct timespec cur_time = current_fs_time(dir->i_sb);
+	struct vfs_time cur_time = current_fs_time(dir->i_sb);
 	struct inode *inode;
 	int ret;
 	int err;
@@ -4956,7 +4956,7 @@  static long _btrfs_ioctl_set_received_subvol(struct file *file,
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_root_item *root_item = &root->root_item;
 	struct btrfs_trans_handle *trans;
-	struct timespec ct = current_fs_time(inode->i_sb);
+	struct vfs_time ct = current_fs_time(inode->i_sb);
 	int ret = 0;
 	int received_uuid_changed;
 
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index a25f3b2..0a309f6b 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -488,7 +488,7 @@  void btrfs_update_root_times(struct btrfs_trans_handle *trans,
 			     struct btrfs_root *root)
 {
 	struct btrfs_root_item *item = &root->root_item;
-	struct timespec ct = current_fs_time(root->fs_info->sb);
+	struct vfs_time ct = current_fs_time(root->fs_info->sb);
 
 	spin_lock(&root->root_item_lock);
 	btrfs_set_root_ctransid(item, trans->transid);
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 37562d6..5481ee0 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1333,7 +1333,7 @@  static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
 	struct dentry *dentry;
 	struct extent_buffer *tmp;
 	struct extent_buffer *old;
-	struct timespec cur_time;
+	struct vfs_time cur_time;
 	int ret = 0;
 	u64 to_reserve = 0;
 	u64 index = 0;