Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1324952
| From | Deepa Dinamani <deepa.kernel@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 02/10] vfs: Replace CURRENT_TIME by current_fs_time() |
| Date | 2016-02-03 07:20 +0100 |
| Message-ID | <qXYXg-6CP-13@gated-at.bofh.it> (permalink) |
| References | <qXYXg-6CP-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The CURRENT_TIME macro is not sufficient for filesystem timestamps since
it does not truncate the values according to filesystem granularity.
simple_link(), simple_unlink() and simple_rename() only need a single
call to current_fs_time() since they do not span filesystems.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
---
fs/libfs.c | 21 +++++++++++++--------
fs/nsfs.c | 3 ++-
fs/pipe.c | 3 ++-
fs/posix_acl.c | 2 +-
4 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/fs/libfs.c b/fs/libfs.c
index 0ca80b2..e3a8ed5 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -237,7 +237,7 @@ struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name,
*/
root->i_ino = 1;
root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
- root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;
+ root->i_atime = root->i_mtime = root->i_ctime = current_fs_time(s);
dentry = __d_alloc(s, &d_name);
if (!dentry) {
iput(root);
@@ -267,7 +267,8 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den
{
struct inode *inode = d_inode(old_dentry);
- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ inode->i_ctime = dir->i_ctime =
+ dir->i_mtime = current_fs_time(dir->i_sb);
inc_nlink(inode);
ihold(inode);
dget(dentry);
@@ -301,7 +302,8 @@ int simple_unlink(struct inode *dir, struct dentry *dentry)
{
struct inode *inode = d_inode(dentry);
- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ inode->i_ctime = dir->i_ctime =
+ dir->i_mtime = current_fs_time(dir->i_sb);
drop_nlink(inode);
dput(dentry);
return 0;
@@ -340,8 +342,9 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
inc_nlink(new_dir);
}
- old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
- new_dir->i_mtime = inode->i_ctime = CURRENT_TIME;
+ old_dir->i_ctime = old_dir->i_mtime =
+ new_dir->i_ctime = new_dir->i_mtime =
+ inode->i_ctime = current_fs_time(inode->i_sb);
return 0;
}
@@ -492,7 +495,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
*/
inode->i_ino = 1;
inode->i_mode = S_IFDIR | 0755;
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_atime = inode->i_mtime = inode->i_ctime = current_fs_time(s);
inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
set_nlink(inode, 2);
@@ -518,7 +521,8 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
goto out;
}
inode->i_mode = S_IFREG | files->mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_fs_time(s);
inode->i_fop = files->ops;
inode->i_ino = i;
d_add(dentry, inode);
@@ -1064,7 +1068,8 @@ struct inode *alloc_anon_inode(struct super_block *s)
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
inode->i_flags |= S_PRIVATE;
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_fs_time(inode->i_sb);
return inode;
}
EXPORT_SYMBOL(alloc_anon_inode);
diff --git a/fs/nsfs.c b/fs/nsfs.c
index 8f20d60..f0e18b2 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -82,7 +82,8 @@ slow:
return ERR_PTR(-ENOMEM);
}
inode->i_ino = ns->inum;
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
+ inode->i_mtime = inode->i_atime =
+ inode->i_ctime = current_fs_time(inode->i_sb);
inode->i_flags |= S_IMMUTABLE;
inode->i_mode = S_IFREG | S_IRUGO;
inode->i_fop = &ns_file_operations;
diff --git a/fs/pipe.c b/fs/pipe.c
index c1c1b26..ad3fc8d 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -699,7 +699,8 @@ static struct inode * get_pipe_inode(void)
inode->i_mode = S_IFIFO | S_IRUSR | S_IWUSR;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_atime = inode->i_mtime =
+ inode->i_ctime = current_fs_time(inode->i_sb);
return inode;
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 711dd51..778a27e 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -859,7 +859,7 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
acl = NULL;
}
- inode->i_ctime = CURRENT_TIME;
+ inode->i_ctime = current_fs_time(inode->i_sb);
set_cached_acl(inode, type, acl);
return 0;
}
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/10] Remove CURRENT_TIME and CURRENT_TIME_SEC - PART 1 Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-03 07:20 +0100
[PATCH 07/10] fs: ext4: Replace CURRENT_TIME with ext4_current_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-03 07:20 +0100
[PATCH 01/10] fs: Add current_fs_time_sec() function Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-03 07:20 +0100
[PATCH 02/10] vfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-03 07:20 +0100
[PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-03 07:20 +0100
Re: [PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() "Yan, Zheng" <ukernel@gmail.com> - 2016-02-03 15:40 +0100
Re: [PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-03 17:20 +0100
Re: [PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() Arnd Bergmann <arnd@arndb.de> - 2016-02-03 22:30 +0100
Re: [PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() "Yan, Zheng" <zyan@redhat.com> - 2016-02-04 03:10 +0100
Re: [PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() Arnd Bergmann <arnd@arndb.de> - 2016-02-04 09:40 +0100
Re: [PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() Ilya Dryomov <idryomov@gmail.com> - 2016-02-04 10:10 +0100
Re: [PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() Arnd Bergmann <arnd@arndb.de> - 2016-02-04 14:40 +0100
Re: [PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() Gregory Farnum <gfarnum@redhat.com> - 2016-02-04 16:30 +0100
Re: [Y2038] [PATCH 09/10] fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts() Arnd Bergmann <arnd@arndb.de> - 2016-02-04 22:10 +0100
[PATCH 08/10] fs: ceph: replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-03 07:20 +0100
Re: [PATCH 08/10] fs: ceph: replace CURRENT_TIME by current_fs_time() "Yan, Zheng" <zyan@redhat.com> - 2016-02-03 07:30 +0100
[PATCH 10/10] fs: btrfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-03 07:20 +0100
Re: [PATCH 10/10] fs: btrfs: Replace CURRENT_TIME by current_fs_time() David Sterba <dsterba@suse.cz> - 2016-02-04 15:20 +0100
Re: [PATCH 10/10] fs: btrfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-05 12:40 +0100
[PATCH v2 10/10] fs: btrfs: Replace CURRENT_TIME by current_fs_time() Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-07 09:00 +0100
Re: [PATCH v2 10/10] fs: btrfs: Replace CURRENT_TIME by current_fs_time() David Sterba <dsterba@suse.cz> - 2016-02-08 16:10 +0100
Re: [Y2038] [PATCH 00/10] Remove CURRENT_TIME and CURRENT_TIME_SEC - PART 1 Arnd Bergmann <arnd@arndb.de> - 2016-02-03 22:40 +0100
Re: [Y2038] [PATCH 00/10] Remove CURRENT_TIME and CURRENT_TIME_SEC - PART 1 Deepa Dinamani <deepa.kernel@gmail.com> - 2016-02-04 06:00 +0100
csiph-web