lkml.org 
[lkml]   [2016]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 12/15] vfs: remove inode_timespec and timespec references
Date
Substitute inode_timespec aliases with timespec64.
Since CONFIG_FS_USES_64BIT_TIME is enabled, internally
all inode_timespec references are using timespec64
already.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
fs/attr.c | 2 +-
fs/bad_inode.c | 2 +-
fs/binfmt_misc.c | 2 +-
fs/inode.c | 36 ++++++++++++++++++------------------
fs/libfs.c | 12 ++++++------
fs/locks.c | 2 +-
fs/nsfs.c | 2 +-
fs/pipe.c | 2 +-
fs/utimes.c | 4 ++--
include/linux/fs.h | 24 +++++++++---------------
include/linux/stat.h | 6 +++---
11 files changed, 44 insertions(+), 50 deletions(-)

diff --git a/fs/attr.c b/fs/attr.c
index 4156239..ec5e9ad 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -192,7 +192,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
struct inode *inode = dentry->d_inode;
umode_t mode = inode->i_mode;
int error;
- struct inode_timespec now;
+ struct timespec64 now;
unsigned int ia_valid = attr->ia_valid;

WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex));
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index 3c51e22..2a8daef 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -169,7 +169,7 @@ static const struct inode_operations bad_inode_ops =

void make_bad_inode(struct inode *inode)
{
- struct inode_timespec now;
+ struct timespec64 now;

remove_inode_hash(inode);

diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 4fd4437..c58ecb7 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -562,7 +562,7 @@ static void entry_status(Node *e, char *page)
static struct inode *bm_get_inode(struct super_block *sb, int mode)
{
struct inode *inode = new_inode(sb);
- struct inode_timespec now;
+ struct timespec64 now;

if (inode) {
inode->i_ino = get_next_ino();
diff --git a/fs/inode.c b/fs/inode.c
index d3d64dc..86218f6 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1532,12 +1532,12 @@ EXPORT_SYMBOL(bmap);
* passed since the last atime update.
*/
static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
- struct inode_timespec now)
+ struct timespec64 now)
{

- struct inode_timespec ctime;
- struct inode_timespec mtime;
- struct inode_timespec atime;
+ struct timespec64 ctime;
+ struct timespec64 mtime;
+ struct timespec64 atime;

if (!(mnt->mnt_flags & MNT_RELATIME))
return 1;
@@ -1549,12 +1549,12 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
/*
* Is mtime younger than atime? If yes, update atime:
*/
- if (inode_timespec_compare(&mtime, &atime) >= 0)
+ if (timespec64_compare(&mtime, &atime) >= 0)
return 1;
/*
* Is ctime younger than atime? If yes, update atime:
*/
- if (inode_timespec_compare(&ctime, &atime) >= 0)
+ if (timespec64_compare(&ctime, &atime) >= 0)
return 1;

/*
@@ -1569,7 +1569,7 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
return 0;
}

-int generic_update_time(struct inode *inode, struct inode_timespec *time,
+int generic_update_time(struct inode *inode, struct timespec64 *time,
int flags)
{
int iflags = I_DIRTY_TIME;
@@ -1594,10 +1594,10 @@ EXPORT_SYMBOL(generic_update_time);
* This does the actual work of updating an inodes time or version. Must have
* had called mnt_want_write() before calling this.
*/
-static int update_time(struct inode *inode, struct inode_timespec *time,
+static int update_time(struct inode *inode, struct timespec64 *time,
int flags)
{
- int (*update_time)(struct inode *, struct inode_timespec *, int);
+ int (*update_time)(struct inode *, struct timespec64 *, int);

update_time = inode->i_op->update_time ? inode->i_op->update_time :
generic_update_time;
@@ -1617,8 +1617,8 @@ static int update_time(struct inode *inode, struct inode_timespec *time,
bool atime_needs_update(const struct path *path, struct inode *inode)
{
struct vfsmount *mnt = path->mnt;
- struct inode_timespec now;
- struct inode_timespec atime;
+ struct timespec64 now;
+ struct timespec64 atime;

if (inode->i_flags & S_NOATIME)
return false;
@@ -1637,7 +1637,7 @@ bool atime_needs_update(const struct path *path, struct inode *inode)
return false;

atime = VFS_INODE_GET_XTIME(i_atime, inode);
- if (inode_timespec_equal(&atime, &now))
+ if (timespec64_equal(&atime, &now))
return false;

return true;
@@ -1647,7 +1647,7 @@ void touch_atime(const struct path *path)
{
struct vfsmount *mnt = path->mnt;
struct inode *inode = d_inode(path->dentry);
- struct inode_timespec now;
+ struct timespec64 now;

if (!atime_needs_update(path, inode))
return;
@@ -1782,9 +1782,9 @@ EXPORT_SYMBOL(file_remove_privs);
int file_update_time(struct file *file)
{
struct inode *inode = file_inode(file);
- struct inode_timespec now;
- struct inode_timespec mtime;
- struct inode_timespec ctime;
+ struct timespec64 now;
+ struct timespec64 mtime;
+ struct timespec64 ctime;

int sync_it = 0;
int ret;
@@ -1798,10 +1798,10 @@ int file_update_time(struct file *file)
mtime = VFS_INODE_GET_XTIME(i_mtime, inode);
ctime = VFS_INODE_GET_XTIME(i_ctime, inode);

- if (!inode_timespec_equal(&mtime, &now))
+ if (!timespec64_equal(&mtime, &now))
sync_it = S_MTIME;

- if (!inode_timespec_equal(&ctime, &now))
+ if (!timespec64_equal(&ctime, &now))
sync_it |= S_CTIME;

if (IS_I_VERSION(inode))
diff --git a/fs/libfs.c b/fs/libfs.c
index 5a0c7c2..ffa9e65 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -216,7 +216,7 @@ struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name,
struct dentry *dentry;
struct inode *root;
struct qstr d_name = QSTR_INIT(name, strlen(name));
- struct inode_timespec now;
+ struct timespec64 now;

s = sget(fs_type, NULL, set_anon_super, MS_NOUSER, NULL);
if (IS_ERR(s))
@@ -274,7 +274,7 @@ EXPORT_SYMBOL(simple_open);
int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
{
struct inode *inode = d_inode(old_dentry);
- struct inode_timespec now = current_fs_time(inode->i_sb);
+ struct timespec64 now = current_fs_time(inode->i_sb);

VFS_INODE_SET_XTIME(i_ctime, inode, now);
VFS_INODE_SET_XTIME(i_mtime, dir, now);
@@ -311,7 +311,7 @@ EXPORT_SYMBOL(simple_empty);
int simple_unlink(struct inode *dir, struct dentry *dentry)
{
struct inode *inode = d_inode(dentry);
- struct inode_timespec now = current_fs_time(inode->i_sb);
+ struct timespec64 now = current_fs_time(inode->i_sb);

VFS_INODE_SET_XTIME(i_ctime, inode, now);
VFS_INODE_SET_XTIME(i_mtime, dir, now);
@@ -339,7 +339,7 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
{
struct inode *inode = d_inode(old_dentry);
int they_are_dirs = d_is_dir(old_dentry);
- struct inode_timespec now;
+ struct timespec64 now;

if (!simple_empty(new_dentry))
return -ENOTEMPTY;
@@ -495,7 +495,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
struct inode *inode;
struct dentry *root;
struct dentry *dentry;
- struct inode_timespec now;
+ struct timespec64 now;
int i;

s->s_blocksize = PAGE_CACHE_SIZE;
@@ -1080,7 +1080,7 @@ struct inode *alloc_anon_inode(struct super_block *s)
.set_page_dirty = anon_set_page_dirty,
};
struct inode *inode = new_inode_pseudo(s);
- struct inode_timespec now;
+ struct timespec64 now;

if (!inode)
return ERR_PTR(-ENOMEM);
diff --git a/fs/locks.c b/fs/locks.c
index 2b818eb..ccf9c23 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1491,7 +1491,7 @@ EXPORT_SYMBOL(__break_lease);
* exclusive leases. The justification is that if someone has an
* exclusive lease, then they could be modifying it.
*/
-void lease_get_mtime(struct inode *inode, struct inode_timespec *time)
+void lease_get_mtime(struct inode *inode, struct timespec64 *time)
{
bool has_lease = false;
struct file_lock_context *ctx;
diff --git a/fs/nsfs.c b/fs/nsfs.c
index a079fc9..e9012b5 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -51,7 +51,7 @@ void *ns_get_path(struct path *path, struct task_struct *task,
struct qstr qname = { .name = "", };
struct dentry *dentry;
struct inode *inode;
- struct inode_timespec now;
+ struct timespec64 now;
struct ns_common *ns;
unsigned long d;

diff --git a/fs/pipe.c b/fs/pipe.c
index 5d414a3..3bcb870 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -637,7 +637,7 @@ static struct inode * get_pipe_inode(void)
{
struct inode *inode = new_inode_pseudo(pipe_mnt->mnt_sb);
struct pipe_inode_info *pipe;
- struct inode_timespec now;
+ struct timespec64 now;

if (!inode)
goto fail_inode;
diff --git a/fs/utimes.c b/fs/utimes.c
index c23c8e6..6c0d208 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -48,7 +48,7 @@ static bool nsec_valid(long nsec)
return nsec >= 0 && nsec <= 999999999;
}

-static int utimes_common(struct path *path, struct inode_timespec *times)
+static int utimes_common(struct path *path, struct timespec64 *times)
{
int error;
struct iattr newattrs;
@@ -135,7 +135,7 @@ out:
* Else, update from *times, must be owner or super user.
*/
long do_utimes(int dfd, const char __user *filename,
- struct inode_timespec *times,
+ struct timespec64 *times,
int flags)
{
int error = -EINVAL;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 5112bc2..4a754a2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -249,9 +249,9 @@ struct iattr {
kuid_t ia_uid;
kgid_t ia_gid;
loff_t ia_size;
- struct inode_timespec ia_atime;
- struct inode_timespec ia_mtime;
- struct inode_timespec ia_ctime;
+ struct timespec64 ia_atime;
+ struct timespec64 ia_mtime;
+ struct timespec64 ia_ctime;

/*
* Not an attribute, but an auxiliary info for filesystems wanting to
@@ -616,18 +616,12 @@ struct inode {
};
dev_t i_rdev;
loff_t i_size;
-#ifdef CONFIG_FS_USES_64BIT_TIME
time64_t i_atime_sec;
time64_t i_mtime_sec;
time64_t i_ctime_sec;
s32 i_atime_nsec;
s32 i_mtime_nsec;
s32 i_ctime_nsec;
-#else
- struct timespec i_atime;
- struct timespec i_mtime;
- struct timespec i_ctime;
-#endif
spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
unsigned short i_bytes;
unsigned int i_blkbits;
@@ -727,7 +721,7 @@ struct inode {

#define VFS_INODE_SWAP_XTIME(xtime, inode1, inode2) \
do { \
- struct inode_timespec __ts = \
+ struct timespec64 __ts = \
VFS_INODE_GET_XTIME(xtime, inode1); \
VFS_INODE_SET_XTIME(xtime, inode1, \
VFS_INODE_GET_XTIME(xtime, inode2)); \
@@ -1448,11 +1442,11 @@ struct super_block {

#endif

-extern int is_fs_timestamp_bad(struct inode_timespec ts);
-extern struct inode_timespec current_fs_time(struct super_block *sb);
-extern struct inode_timespec current_fs_time_sec(struct super_block *sb);
-extern struct inode_timespec
-fs_time_trunc(struct inode_timespec ts, struct super_block *sb);
+extern int is_fs_timestamp_bad(struct timespec64 ts);
+extern struct timespec64 current_fs_time(struct super_block *sb);
+extern struct timespec64 current_fs_time_sec(struct super_block *sb);
+extern struct timespec64
+fs_time_trunc(struct timespec64 ts, struct super_block *sb);

/*
* Snapshotting support.
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 559983f..5561337 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -27,9 +27,9 @@ struct kstat {
kgid_t gid;
dev_t rdev;
loff_t size;
- struct inode_timespec atime;
- struct inode_timespec mtime;
- struct inode_timespec ctime;
+ struct timespec64 atime;
+ struct timespec64 mtime;
+ struct timespec64 ctime;
unsigned long blksize;
unsigned long long blocks;
};
--
1.9.1


\
 
 \ /
  Last update: 2016-01-07 07:21    [W:0.975 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site