From: Deepa Dinamani <deepa.kernel@gmail.com>
To: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org
Cc: Arnd Bergmann <arnd@arndb.de>, Dave Chinner <david@fromorbit.com>,
"Theodore Ts'o" <tytso@mit.edu>,
linux-kernel@vger.kernel.org
Subject: [RFC v2c 6/8] fs: btrfs: Use vfs timestamp abstraction helper
Date: Fri, 12 Feb 2016 01:52:51 -0800 [thread overview]
Message-ID: <1455270773-3249-7-git-send-email-deepa.kernel@gmail.com> (raw)
In-Reply-To: <1455270773-3249-1-git-send-email-deepa.kernel@gmail.com>
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 timespec64 and conversion functions 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().
4. btrfs_timespec already uses 64 bits to represent seconds in timestamps
as 64 bits in btrfs_timespec.
5. btrfs_update_time() is a inode_ops callback.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
fs/btrfs/file.c | 7 ++++---
fs/btrfs/inode.c | 2 +-
fs/btrfs/ioctl.c | 4 ++--
fs/btrfs/root-tree.c | 2 +-
fs/btrfs/transaction.c | 2 +-
5 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 610f569..a5fb13c 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1732,16 +1732,17 @@ 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/inode.c b/fs/btrfs/inode.c
index bcd223c..860e5e6 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5942,7 +5942,7 @@ static int btrfs_dirty_inode(struct inode *inode)
* This is a copy of file_update_time. We need this so we can return error on
* ENOSPC for updating the inode in the case of file write and mmap writes.
*/
-static int btrfs_update_time(struct inode *inode, struct timespec *now,
+static int btrfs_update_time(struct inode *inode, struct vfs_time *now,
int flags)
{
struct btrfs_root *root = BTRFS_I(inode)->root;
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;
--
1.9.1
next prev parent reply other threads:[~2016-02-12 9:56 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-12 9:21 [RFC v2] vfs 64 bit time transition proposals Deepa Dinamani
2016-02-12 9:35 ` [RFC v2a 00/12] vfs 64 bit time transition proposal Deepa Dinamani
2016-02-12 9:35 ` [RFC v2a 01/12] vfs: Add vfs_time abstractions Deepa Dinamani
2016-02-12 9:35 ` [RFC v2a 02/12] fs: cifs: Change cifs_fscache_inode_auxdata to use vfs_time data type Deepa Dinamani
2016-02-12 9:35 ` [RFC v2a 03/12] fs: cifs: Change cifs_fattr timestamps data type to vfs_time Deepa Dinamani
2016-02-12 9:35 ` [RFC v2a 04/12] fs: cifs: Make cnvrtDosUnixTm() y2038 safe Deepa Dinamani
2016-02-12 9:35 ` [RFC v2a 05/12] fs: cifs: Use vfs_time_get_real_* time functions Deepa Dinamani
2016-02-12 9:36 ` [RFC v2a 06/12] fs: btrfs: Change btrfs_inode.i_otime to use vfs_time data type Deepa Dinamani
2016-02-12 9:36 ` [RFC v2a 07/12] fs: btrfs: Use vfs_time data type for btrfs_update_time() Deepa Dinamani
2016-02-12 9:36 ` [RFC v2a 08/12] fs: btrfs: Change timespec data types to use vfs_time Deepa Dinamani
2016-02-12 9:36 ` [RFC v2a 09/12] fs: ceph: Change encode and decode functions " Deepa Dinamani
2016-02-12 9:36 ` [RFC v2a 10/12] fs: ceph: Replace timespec data type with vfs_time Deepa Dinamani
2016-02-12 9:36 ` [RFC v2a 11/12] net: ceph: use vfs_time data type instead of timespec Deepa Dinamani
2016-02-13 22:08 ` Dave Chinner
2016-02-14 1:46 ` Deepa Dinamani
2016-02-14 2:05 ` Deepa Dinamani
2016-02-14 21:00 ` Dave Chinner
2016-02-17 9:32 ` Arnd Bergmann
2016-02-12 9:36 ` [RFC v2a 12/12] fs: xfs: change inode times to use vfs_time data type Deepa Dinamani
2016-02-12 9:45 ` [RFC v2b 0/5] vfs 64 bit time transition proposal Deepa Dinamani
2016-02-12 9:45 ` [RFC v2b 1/5] vfs: Add vfs_time accessors Deepa Dinamani
2016-02-12 9:45 ` [RFC v2b 2/5] fs: cifs: Use " Deepa Dinamani
2016-02-12 9:45 ` [RFC v2b 3/5] fs: btrfs: " Deepa Dinamani
2016-02-12 13:57 ` Arnd Bergmann
2016-02-13 7:01 ` Deepa Dinamani
2016-02-12 9:45 ` [RFC v2b 4/5] fs: ceph: Use vfs timestamp accessors Deepa Dinamani
2016-02-12 9:45 ` [RFC v2b 5/5] fs: xfs: change inode times to use vfs_time data type Deepa Dinamani
2016-02-13 2:18 ` Dave Chinner
2016-02-13 14:50 ` [Y2038] " Arnd Bergmann
2016-02-13 15:56 ` David F.
2016-02-12 9:52 ` [RFC v2c 0/8] vfs 64 bit time transition proposal Deepa Dinamani
2016-02-12 9:52 ` [RFC v2c 1/8] vfs: Add vfs_time abstractions Deepa Dinamani
2016-02-12 9:52 ` [RFC v2c 2/8] fs: cifs: Change auxdata to struct timespec64 data type Deepa Dinamani
2016-02-12 9:52 ` [RFC v2c 3/8] fs: cifs: Change cifs_fattr timestamps data type to timespec64 Deepa Dinamani
2016-02-12 9:52 ` [RFC v2c 4/8] fs: cifs: Make cnvrtDosUnixTm() y2038 safe Deepa Dinamani
2016-02-12 9:52 ` [RFC v2c 5/8] fs: btrfs: Change btrfs_inode.i_otime to vfs_time data type Deepa Dinamani
2016-02-12 9:52 ` Deepa Dinamani [this message]
2016-02-12 9:52 ` [RFC v2c 7/8] fs: ceph: Use vfs timestamp abstraction helpers Deepa Dinamani
2016-02-12 9:52 ` [RFC v2c 8/8] fs: xfs: change inode times to use vfs_time data type Deepa Dinamani
2016-02-12 14:03 ` [Y2038] [RFC v2] vfs 64 bit time transition proposals Arnd Bergmann
2016-02-13 6:58 ` Deepa Dinamani
2016-02-13 11:54 ` Deepa Dinamani
2016-02-24 12:19 ` [Y2038] " Thomas Gleixner
2016-02-24 12:26 ` Julia Lawall
2016-02-24 13:56 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455270773-3249-7-git-send-email-deepa.kernel@gmail.com \
--to=deepa.kernel@gmail.com \
--cc=arnd@arndb.de \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=y2038@lists.linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).