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

bfs: 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-20-jlayton@kernel.orgSigned-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 3aa4155c
...@@ -97,7 +97,7 @@ static int bfs_create(struct mnt_idmap *idmap, struct inode *dir, ...@@ -97,7 +97,7 @@ static int bfs_create(struct mnt_idmap *idmap, struct inode *dir,
set_bit(ino, info->si_imap); set_bit(ino, info->si_imap);
info->si_freei--; info->si_freei--;
inode_init_owner(&nop_mnt_idmap, inode, dir, mode); inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); simple_inode_init_ts(inode);
inode->i_blocks = 0; inode->i_blocks = 0;
inode->i_op = &bfs_file_inops; inode->i_op = &bfs_file_inops;
inode->i_fop = &bfs_file_operations; inode->i_fop = &bfs_file_operations;
...@@ -187,7 +187,7 @@ static int bfs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -187,7 +187,7 @@ static int bfs_unlink(struct inode *dir, struct dentry *dentry)
} }
de->ino = 0; de->ino = 0;
mark_buffer_dirty_inode(bh, dir); mark_buffer_dirty_inode(bh, dir);
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);
inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); inode_set_ctime_to_ts(inode, inode_get_ctime(dir));
inode_dec_link_count(inode); inode_dec_link_count(inode);
...@@ -240,7 +240,7 @@ static int bfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, ...@@ -240,7 +240,7 @@ static int bfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
goto end_rename; goto end_rename;
} }
old_de->ino = 0; old_de->ino = 0;
old_dir->i_mtime = inode_set_ctime_current(old_dir); inode_set_mtime_to_ts(old_dir, inode_set_ctime_current(old_dir));
mark_inode_dirty(old_dir); mark_inode_dirty(old_dir);
if (new_inode) { if (new_inode) {
inode_set_ctime_current(new_inode); inode_set_ctime_current(new_inode);
...@@ -294,7 +294,8 @@ static int bfs_add_entry(struct inode *dir, const struct qstr *child, int ino) ...@@ -294,7 +294,8 @@ static int bfs_add_entry(struct inode *dir, const struct qstr *child, int ino)
dir->i_size += BFS_DIRENT_SIZE; dir->i_size += BFS_DIRENT_SIZE;
inode_set_ctime_current(dir); inode_set_ctime_current(dir);
} }
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);
de->ino = cpu_to_le16((u16)ino); de->ino = cpu_to_le16((u16)ino);
for (i = 0; i < BFS_NAMELEN; i++) for (i = 0; i < BFS_NAMELEN; i++)
......
...@@ -80,11 +80,9 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino) ...@@ -80,11 +80,9 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
set_nlink(inode, le32_to_cpu(di->i_nlink)); set_nlink(inode, le32_to_cpu(di->i_nlink));
inode->i_size = BFS_FILESIZE(di); inode->i_size = BFS_FILESIZE(di);
inode->i_blocks = BFS_FILEBLOCKS(di); inode->i_blocks = BFS_FILEBLOCKS(di);
inode->i_atime.tv_sec = le32_to_cpu(di->i_atime); inode_set_atime(inode, le32_to_cpu(di->i_atime), 0);
inode->i_mtime.tv_sec = le32_to_cpu(di->i_mtime); inode_set_mtime(inode, le32_to_cpu(di->i_mtime), 0);
inode_set_ctime(inode, le32_to_cpu(di->i_ctime), 0); inode_set_ctime(inode, le32_to_cpu(di->i_ctime), 0);
inode->i_atime.tv_nsec = 0;
inode->i_mtime.tv_nsec = 0;
brelse(bh); brelse(bh);
unlock_new_inode(inode); unlock_new_inode(inode);
...@@ -140,9 +138,9 @@ static int bfs_write_inode(struct inode *inode, struct writeback_control *wbc) ...@@ -140,9 +138,9 @@ static int bfs_write_inode(struct inode *inode, struct writeback_control *wbc)
di->i_uid = cpu_to_le32(i_uid_read(inode)); di->i_uid = cpu_to_le32(i_uid_read(inode));
di->i_gid = cpu_to_le32(i_gid_read(inode)); di->i_gid = cpu_to_le32(i_gid_read(inode));
di->i_nlink = cpu_to_le32(inode->i_nlink); di->i_nlink = cpu_to_le32(inode->i_nlink);
di->i_atime = cpu_to_le32(inode->i_atime.tv_sec); di->i_atime = cpu_to_le32(inode_get_atime_sec(inode));
di->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec); di->i_mtime = cpu_to_le32(inode_get_mtime_sec(inode));
di->i_ctime = cpu_to_le32(inode_get_ctime(inode).tv_sec); di->i_ctime = cpu_to_le32(inode_get_ctime_sec(inode));
i_sblock = BFS_I(inode)->i_sblock; i_sblock = BFS_I(inode)->i_sblock;
di->i_sblock = cpu_to_le32(i_sblock); di->i_sblock = cpu_to_le32(i_sblock);
di->i_eblock = cpu_to_le32(BFS_I(inode)->i_eblock); di->i_eblock = cpu_to_le32(BFS_I(inode)->i_eblock);
......
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