Commit d936d382 authored by Jeff Layton's avatar Jeff Layton Committed by Christian Brauner

ufs: 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-73-jlayton@kernel.orgSigned-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent f972fed7
...@@ -107,7 +107,7 @@ void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de, ...@@ -107,7 +107,7 @@ void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
ufs_commit_chunk(page, pos, len); ufs_commit_chunk(page, pos, len);
ufs_put_page(page); ufs_put_page(page);
if (update_times) if (update_times)
dir->i_mtime = inode_set_ctime_current(dir); inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
mark_inode_dirty(dir); mark_inode_dirty(dir);
ufs_handle_dirsync(dir); ufs_handle_dirsync(dir);
} }
...@@ -397,7 +397,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode) ...@@ -397,7 +397,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)
ufs_set_de_type(sb, de, inode->i_mode); ufs_set_de_type(sb, de, inode->i_mode);
ufs_commit_chunk(page, pos, rec_len); ufs_commit_chunk(page, pos, rec_len);
dir->i_mtime = inode_set_ctime_current(dir); inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
mark_inode_dirty(dir); mark_inode_dirty(dir);
err = ufs_handle_dirsync(dir); err = ufs_handle_dirsync(dir);
...@@ -539,7 +539,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir, ...@@ -539,7 +539,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
pde->d_reclen = cpu_to_fs16(sb, to - from); pde->d_reclen = cpu_to_fs16(sb, to - from);
dir->d_ino = 0; dir->d_ino = 0;
ufs_commit_chunk(page, pos, to - from); ufs_commit_chunk(page, pos, to - from);
inode->i_mtime = inode_set_ctime_current(inode); inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
mark_inode_dirty(inode); mark_inode_dirty(inode);
err = ufs_handle_dirsync(inode); err = ufs_handle_dirsync(inode);
out: out:
......
...@@ -292,7 +292,7 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode) ...@@ -292,7 +292,7 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode)
inode_init_owner(&nop_mnt_idmap, inode, dir, mode); inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
inode->i_blocks = 0; inode->i_blocks = 0;
inode->i_generation = 0; inode->i_generation = 0;
inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); simple_inode_init_ts(inode);
ufsi->i_flags = UFS_I(dir)->i_flags; ufsi->i_flags = UFS_I(dir)->i_flags;
ufsi->i_lastfrag = 0; ufsi->i_lastfrag = 0;
ufsi->i_shadow = 0; ufsi->i_shadow = 0;
......
...@@ -579,13 +579,15 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) ...@@ -579,13 +579,15 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode)
i_gid_write(inode, ufs_get_inode_gid(sb, ufs_inode)); i_gid_write(inode, ufs_get_inode_gid(sb, ufs_inode));
inode->i_size = fs64_to_cpu(sb, ufs_inode->ui_size); inode->i_size = fs64_to_cpu(sb, ufs_inode->ui_size);
inode->i_atime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_atime.tv_sec); inode_set_atime(inode,
(signed)fs32_to_cpu(sb, ufs_inode->ui_atime.tv_sec),
0);
inode_set_ctime(inode, inode_set_ctime(inode,
(signed)fs32_to_cpu(sb, ufs_inode->ui_ctime.tv_sec), (signed)fs32_to_cpu(sb, ufs_inode->ui_ctime.tv_sec),
0); 0);
inode->i_mtime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_mtime.tv_sec); inode_set_mtime(inode,
inode->i_mtime.tv_nsec = 0; (signed)fs32_to_cpu(sb, ufs_inode->ui_mtime.tv_sec),
inode->i_atime.tv_nsec = 0; 0);
inode->i_blocks = fs32_to_cpu(sb, ufs_inode->ui_blocks); inode->i_blocks = fs32_to_cpu(sb, ufs_inode->ui_blocks);
inode->i_generation = fs32_to_cpu(sb, ufs_inode->ui_gen); inode->i_generation = fs32_to_cpu(sb, ufs_inode->ui_gen);
ufsi->i_flags = fs32_to_cpu(sb, ufs_inode->ui_flags); ufsi->i_flags = fs32_to_cpu(sb, ufs_inode->ui_flags);
...@@ -626,12 +628,12 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) ...@@ -626,12 +628,12 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode)
i_gid_write(inode, fs32_to_cpu(sb, ufs2_inode->ui_gid)); i_gid_write(inode, fs32_to_cpu(sb, ufs2_inode->ui_gid));
inode->i_size = fs64_to_cpu(sb, ufs2_inode->ui_size); inode->i_size = fs64_to_cpu(sb, ufs2_inode->ui_size);
inode->i_atime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_atime); inode_set_atime(inode, fs64_to_cpu(sb, ufs2_inode->ui_atime),
fs32_to_cpu(sb, ufs2_inode->ui_atimensec));
inode_set_ctime(inode, fs64_to_cpu(sb, ufs2_inode->ui_ctime), inode_set_ctime(inode, fs64_to_cpu(sb, ufs2_inode->ui_ctime),
fs32_to_cpu(sb, ufs2_inode->ui_ctimensec)); fs32_to_cpu(sb, ufs2_inode->ui_ctimensec));
inode->i_mtime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_mtime); inode_set_mtime(inode, fs64_to_cpu(sb, ufs2_inode->ui_mtime),
inode->i_atime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_atimensec); fs32_to_cpu(sb, ufs2_inode->ui_mtimensec));
inode->i_mtime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_mtimensec);
inode->i_blocks = fs64_to_cpu(sb, ufs2_inode->ui_blocks); inode->i_blocks = fs64_to_cpu(sb, ufs2_inode->ui_blocks);
inode->i_generation = fs32_to_cpu(sb, ufs2_inode->ui_gen); inode->i_generation = fs32_to_cpu(sb, ufs2_inode->ui_gen);
ufsi->i_flags = fs32_to_cpu(sb, ufs2_inode->ui_flags); ufsi->i_flags = fs32_to_cpu(sb, ufs2_inode->ui_flags);
...@@ -725,12 +727,14 @@ static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode) ...@@ -725,12 +727,14 @@ static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode)
ufs_set_inode_gid(sb, ufs_inode, i_gid_read(inode)); ufs_set_inode_gid(sb, ufs_inode, i_gid_read(inode));
ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size);
ufs_inode->ui_atime.tv_sec = cpu_to_fs32(sb, inode->i_atime.tv_sec); ufs_inode->ui_atime.tv_sec = cpu_to_fs32(sb,
inode_get_atime_sec(inode));
ufs_inode->ui_atime.tv_usec = 0; ufs_inode->ui_atime.tv_usec = 0;
ufs_inode->ui_ctime.tv_sec = cpu_to_fs32(sb, ufs_inode->ui_ctime.tv_sec = cpu_to_fs32(sb,
inode_get_ctime(inode).tv_sec); inode_get_ctime_sec(inode));
ufs_inode->ui_ctime.tv_usec = 0; ufs_inode->ui_ctime.tv_usec = 0;
ufs_inode->ui_mtime.tv_sec = cpu_to_fs32(sb, inode->i_mtime.tv_sec); ufs_inode->ui_mtime.tv_sec = cpu_to_fs32(sb,
inode_get_mtime_sec(inode));
ufs_inode->ui_mtime.tv_usec = 0; ufs_inode->ui_mtime.tv_usec = 0;
ufs_inode->ui_blocks = cpu_to_fs32(sb, inode->i_blocks); ufs_inode->ui_blocks = cpu_to_fs32(sb, inode->i_blocks);
ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags); ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags);
...@@ -770,13 +774,15 @@ static void ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode) ...@@ -770,13 +774,15 @@ static void ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode)
ufs_inode->ui_gid = cpu_to_fs32(sb, i_gid_read(inode)); ufs_inode->ui_gid = cpu_to_fs32(sb, i_gid_read(inode));
ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size);
ufs_inode->ui_atime = cpu_to_fs64(sb, inode->i_atime.tv_sec); ufs_inode->ui_atime = cpu_to_fs64(sb, inode_get_atime_sec(inode));
ufs_inode->ui_atimensec = cpu_to_fs32(sb, inode->i_atime.tv_nsec); ufs_inode->ui_atimensec = cpu_to_fs32(sb,
ufs_inode->ui_ctime = cpu_to_fs64(sb, inode_get_ctime(inode).tv_sec); inode_get_atime_nsec(inode));
ufs_inode->ui_ctime = cpu_to_fs64(sb, inode_get_ctime_sec(inode));
ufs_inode->ui_ctimensec = cpu_to_fs32(sb, ufs_inode->ui_ctimensec = cpu_to_fs32(sb,
inode_get_ctime(inode).tv_nsec); inode_get_ctime_nsec(inode));
ufs_inode->ui_mtime = cpu_to_fs64(sb, inode->i_mtime.tv_sec); ufs_inode->ui_mtime = cpu_to_fs64(sb, inode_get_mtime_sec(inode));
ufs_inode->ui_mtimensec = cpu_to_fs32(sb, inode->i_mtime.tv_nsec); ufs_inode->ui_mtimensec = cpu_to_fs32(sb,
inode_get_mtime_nsec(inode));
ufs_inode->ui_blocks = cpu_to_fs64(sb, inode->i_blocks); ufs_inode->ui_blocks = cpu_to_fs64(sb, inode->i_blocks);
ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags); ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags);
...@@ -1208,7 +1214,7 @@ static int ufs_truncate(struct inode *inode, loff_t size) ...@@ -1208,7 +1214,7 @@ static int ufs_truncate(struct inode *inode, loff_t size)
truncate_setsize(inode, size); truncate_setsize(inode, size);
ufs_truncate_blocks(inode); ufs_truncate_blocks(inode);
inode->i_mtime = inode_set_ctime_current(inode); inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
mark_inode_dirty(inode); mark_inode_dirty(inode);
out: out:
UFSD("EXIT: err %d\n", err); UFSD("EXIT: err %d\n", err);
......
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