Commit 95af66c4 authored by Jeff Layton's avatar Jeff Layton Committed by Christian Brauner

jffs2: convert to new timestamp accessors

Convert to using the new inode timestamp accessor functions.
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20231004185347.80880-45-jlayton@kernel.orgSigned-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 5a4bff92
...@@ -204,8 +204,8 @@ static int jffs2_create(struct mnt_idmap *idmap, struct inode *dir_i, ...@@ -204,8 +204,8 @@ static int jffs2_create(struct mnt_idmap *idmap, struct inode *dir_i,
if (ret) if (ret)
goto fail; goto fail;
dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, inode_set_mtime_to_ts(dir_i,
ITIME(je32_to_cpu(ri->ctime))); inode_set_ctime_to_ts(dir_i, ITIME(je32_to_cpu(ri->ctime))));
jffs2_free_raw_inode(ri); jffs2_free_raw_inode(ri);
...@@ -238,7 +238,8 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry) ...@@ -238,7 +238,8 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry)
if (dead_f->inocache) if (dead_f->inocache)
set_nlink(d_inode(dentry), dead_f->inocache->pino_nlink); set_nlink(d_inode(dentry), dead_f->inocache->pino_nlink);
if (!ret) if (!ret)
dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, ITIME(now)); inode_set_mtime_to_ts(dir_i,
inode_set_ctime_to_ts(dir_i, ITIME(now)));
return ret; return ret;
} }
/***********************************************************************/ /***********************************************************************/
...@@ -272,7 +273,8 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de ...@@ -272,7 +273,8 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de
set_nlink(d_inode(old_dentry), ++f->inocache->pino_nlink); set_nlink(d_inode(old_dentry), ++f->inocache->pino_nlink);
mutex_unlock(&f->sem); mutex_unlock(&f->sem);
d_instantiate(dentry, d_inode(old_dentry)); d_instantiate(dentry, d_inode(old_dentry));
dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, ITIME(now)); inode_set_mtime_to_ts(dir_i,
inode_set_ctime_to_ts(dir_i, ITIME(now)));
ihold(d_inode(old_dentry)); ihold(d_inode(old_dentry));
} }
return ret; return ret;
...@@ -423,8 +425,8 @@ static int jffs2_symlink (struct mnt_idmap *idmap, struct inode *dir_i, ...@@ -423,8 +425,8 @@ static int jffs2_symlink (struct mnt_idmap *idmap, struct inode *dir_i,
goto fail; goto fail;
} }
dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, inode_set_mtime_to_ts(dir_i,
ITIME(je32_to_cpu(rd->mctime))); inode_set_ctime_to_ts(dir_i, ITIME(je32_to_cpu(rd->mctime))));
jffs2_free_raw_dirent(rd); jffs2_free_raw_dirent(rd);
...@@ -568,8 +570,8 @@ static int jffs2_mkdir (struct mnt_idmap *idmap, struct inode *dir_i, ...@@ -568,8 +570,8 @@ static int jffs2_mkdir (struct mnt_idmap *idmap, struct inode *dir_i,
goto fail; goto fail;
} }
dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, inode_set_mtime_to_ts(dir_i,
ITIME(je32_to_cpu(rd->mctime))); inode_set_ctime_to_ts(dir_i, ITIME(je32_to_cpu(rd->mctime))));
inc_nlink(dir_i); inc_nlink(dir_i);
jffs2_free_raw_dirent(rd); jffs2_free_raw_dirent(rd);
...@@ -610,7 +612,8 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) ...@@ -610,7 +612,8 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name,
dentry->d_name.len, f, now); dentry->d_name.len, f, now);
if (!ret) { if (!ret) {
dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, ITIME(now)); inode_set_mtime_to_ts(dir_i,
inode_set_ctime_to_ts(dir_i, ITIME(now)));
clear_nlink(d_inode(dentry)); clear_nlink(d_inode(dentry));
drop_nlink(dir_i); drop_nlink(dir_i);
} }
...@@ -746,8 +749,8 @@ static int jffs2_mknod (struct mnt_idmap *idmap, struct inode *dir_i, ...@@ -746,8 +749,8 @@ static int jffs2_mknod (struct mnt_idmap *idmap, struct inode *dir_i,
goto fail; goto fail;
} }
dir_i->i_mtime = inode_set_ctime_to_ts(dir_i, inode_set_mtime_to_ts(dir_i,
ITIME(je32_to_cpu(rd->mctime))); inode_set_ctime_to_ts(dir_i, ITIME(je32_to_cpu(rd->mctime))));
jffs2_free_raw_dirent(rd); jffs2_free_raw_dirent(rd);
...@@ -868,16 +871,18 @@ static int jffs2_rename (struct mnt_idmap *idmap, ...@@ -868,16 +871,18 @@ static int jffs2_rename (struct mnt_idmap *idmap,
* caller won't do it on its own since we are returning an error. * caller won't do it on its own since we are returning an error.
*/ */
d_invalidate(new_dentry); d_invalidate(new_dentry);
new_dir_i->i_mtime = inode_set_ctime_to_ts(new_dir_i, inode_set_mtime_to_ts(new_dir_i,
ITIME(now)); inode_set_ctime_to_ts(new_dir_i, ITIME(now)));
return ret; return ret;
} }
if (d_is_dir(old_dentry)) if (d_is_dir(old_dentry))
drop_nlink(old_dir_i); drop_nlink(old_dir_i);
old_dir_i->i_mtime = inode_set_ctime_to_ts(old_dir_i, ITIME(now)); inode_set_mtime_to_ts(old_dir_i,
new_dir_i->i_mtime = inode_set_ctime_to_ts(new_dir_i, ITIME(now)); inode_set_ctime_to_ts(old_dir_i, ITIME(now)));
inode_set_mtime_to_ts(new_dir_i,
inode_set_ctime_to_ts(new_dir_i, ITIME(now)));
return 0; return 0;
} }
......
...@@ -317,8 +317,8 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, ...@@ -317,8 +317,8 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
inode->i_size = pos + writtenlen; inode->i_size = pos + writtenlen;
inode->i_blocks = (inode->i_size + 511) >> 9; inode->i_blocks = (inode->i_size + 511) >> 9;
inode->i_mtime = inode_set_ctime_to_ts(inode, inode_set_mtime_to_ts(inode,
ITIME(je32_to_cpu(ri->ctime))); inode_set_ctime_to_ts(inode, ITIME(je32_to_cpu(ri->ctime))));
} }
} }
......
...@@ -113,8 +113,8 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) ...@@ -113,8 +113,8 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
ri->isize = cpu_to_je32((ivalid & ATTR_SIZE)?iattr->ia_size:inode->i_size); ri->isize = cpu_to_je32((ivalid & ATTR_SIZE)?iattr->ia_size:inode->i_size);
ri->atime = cpu_to_je32(I_SEC((ivalid & ATTR_ATIME)?iattr->ia_atime:inode->i_atime)); ri->atime = cpu_to_je32(I_SEC((ivalid & ATTR_ATIME)?iattr->ia_atime:inode_get_atime(inode)));
ri->mtime = cpu_to_je32(I_SEC((ivalid & ATTR_MTIME)?iattr->ia_mtime:inode->i_mtime)); ri->mtime = cpu_to_je32(I_SEC((ivalid & ATTR_MTIME)?iattr->ia_mtime:inode_get_mtime(inode)));
ri->ctime = cpu_to_je32(I_SEC((ivalid & ATTR_CTIME)?iattr->ia_ctime:inode_get_ctime(inode))); ri->ctime = cpu_to_je32(I_SEC((ivalid & ATTR_CTIME)?iattr->ia_ctime:inode_get_ctime(inode)));
ri->offset = cpu_to_je32(0); ri->offset = cpu_to_je32(0);
...@@ -147,9 +147,9 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) ...@@ -147,9 +147,9 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
return PTR_ERR(new_metadata); return PTR_ERR(new_metadata);
} }
/* It worked. Update the inode */ /* It worked. Update the inode */
inode->i_atime = ITIME(je32_to_cpu(ri->atime)); inode_set_atime_to_ts(inode, ITIME(je32_to_cpu(ri->atime)));
inode_set_ctime_to_ts(inode, ITIME(je32_to_cpu(ri->ctime))); inode_set_ctime_to_ts(inode, ITIME(je32_to_cpu(ri->ctime)));
inode->i_mtime = ITIME(je32_to_cpu(ri->mtime)); inode_set_mtime_to_ts(inode, ITIME(je32_to_cpu(ri->mtime)));
inode->i_mode = jemode_to_cpu(ri->mode); inode->i_mode = jemode_to_cpu(ri->mode);
i_uid_write(inode, je16_to_cpu(ri->uid)); i_uid_write(inode, je16_to_cpu(ri->uid));
i_gid_write(inode, je16_to_cpu(ri->gid)); i_gid_write(inode, je16_to_cpu(ri->gid));
...@@ -282,8 +282,8 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) ...@@ -282,8 +282,8 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
i_uid_write(inode, je16_to_cpu(latest_node.uid)); i_uid_write(inode, je16_to_cpu(latest_node.uid));
i_gid_write(inode, je16_to_cpu(latest_node.gid)); i_gid_write(inode, je16_to_cpu(latest_node.gid));
inode->i_size = je32_to_cpu(latest_node.isize); inode->i_size = je32_to_cpu(latest_node.isize);
inode->i_atime = ITIME(je32_to_cpu(latest_node.atime)); inode_set_atime_to_ts(inode, ITIME(je32_to_cpu(latest_node.atime)));
inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime)); inode_set_mtime_to_ts(inode, ITIME(je32_to_cpu(latest_node.mtime)));
inode_set_ctime_to_ts(inode, ITIME(je32_to_cpu(latest_node.ctime))); inode_set_ctime_to_ts(inode, ITIME(je32_to_cpu(latest_node.ctime)));
set_nlink(inode, f->inocache->pino_nlink); set_nlink(inode, f->inocache->pino_nlink);
...@@ -386,8 +386,8 @@ void jffs2_dirty_inode(struct inode *inode, int flags) ...@@ -386,8 +386,8 @@ void jffs2_dirty_inode(struct inode *inode, int flags)
iattr.ia_mode = inode->i_mode; iattr.ia_mode = inode->i_mode;
iattr.ia_uid = inode->i_uid; iattr.ia_uid = inode->i_uid;
iattr.ia_gid = inode->i_gid; iattr.ia_gid = inode->i_gid;
iattr.ia_atime = inode->i_atime; iattr.ia_atime = inode_get_atime(inode);
iattr.ia_mtime = inode->i_mtime; iattr.ia_mtime = inode_get_mtime(inode);
iattr.ia_ctime = inode_get_ctime(inode); iattr.ia_ctime = inode_get_ctime(inode);
jffs2_do_setattr(inode, &iattr); jffs2_do_setattr(inode, &iattr);
...@@ -475,8 +475,8 @@ struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_r ...@@ -475,8 +475,8 @@ struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_r
inode->i_mode = jemode_to_cpu(ri->mode); inode->i_mode = jemode_to_cpu(ri->mode);
i_gid_write(inode, je16_to_cpu(ri->gid)); i_gid_write(inode, je16_to_cpu(ri->gid));
i_uid_write(inode, je16_to_cpu(ri->uid)); i_uid_write(inode, je16_to_cpu(ri->uid));
inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); simple_inode_init_ts(inode);
ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime)); ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode_get_mtime(inode)));
inode->i_blocks = 0; inode->i_blocks = 0;
inode->i_size = 0; inode->i_size = 0;
......
...@@ -36,8 +36,8 @@ struct kvec; ...@@ -36,8 +36,8 @@ struct kvec;
#define JFFS2_NOW() JFFS2_CLAMP_TIME(ktime_get_real_seconds()) #define JFFS2_NOW() JFFS2_CLAMP_TIME(ktime_get_real_seconds())
#define I_SEC(tv) JFFS2_CLAMP_TIME((tv).tv_sec) #define I_SEC(tv) JFFS2_CLAMP_TIME((tv).tv_sec)
#define JFFS2_F_I_CTIME(f) I_SEC(inode_get_ctime(OFNI_EDONI_2SFFJ(f))) #define JFFS2_F_I_CTIME(f) I_SEC(inode_get_ctime(OFNI_EDONI_2SFFJ(f)))
#define JFFS2_F_I_MTIME(f) I_SEC(OFNI_EDONI_2SFFJ(f)->i_mtime) #define JFFS2_F_I_MTIME(f) I_SEC(inode_get_mtime(OFNI_EDONI_2SFFJ(f)))
#define JFFS2_F_I_ATIME(f) I_SEC(OFNI_EDONI_2SFFJ(f)->i_atime) #define JFFS2_F_I_ATIME(f) I_SEC(inode_get_atime(OFNI_EDONI_2SFFJ(f)))
#define sleep_on_spinunlock(wq, s) \ #define sleep_on_spinunlock(wq, s) \
do { \ do { \
DECLARE_WAITQUEUE(__wait, current); \ DECLARE_WAITQUEUE(__wait, current); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment