omfs: convert to ctime accessor functions

In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.

Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Message-Id: <20230705190309.579783-61-jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Jeff Layton 2023-07-05 15:01:28 -04:00 committed by Christian Brauner
parent 6861de979f
commit 906effbf67
2 changed files with 6 additions and 7 deletions

View file

@ -143,7 +143,7 @@ static int omfs_add_link(struct dentry *dentry, struct inode *inode)
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
brelse(bh); brelse(bh);
dir->i_ctime = current_time(dir); inode_set_ctime_current(dir);
/* mark affected inodes dirty to rebuild checksums */ /* mark affected inodes dirty to rebuild checksums */
mark_inode_dirty(dir); mark_inode_dirty(dir);
@ -399,7 +399,7 @@ static int omfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
if (err) if (err)
goto out; goto out;
old_inode->i_ctime = current_time(old_inode); inode_set_ctime_current(old_inode);
mark_inode_dirty(old_inode); mark_inode_dirty(old_inode);
out: out:
return err; return err;

View file

@ -51,7 +51,7 @@ struct inode *omfs_new_inode(struct inode *dir, umode_t mode)
inode_init_owner(&nop_mnt_idmap, inode, NULL, mode); inode_init_owner(&nop_mnt_idmap, inode, NULL, mode);
inode->i_mapping->a_ops = &omfs_aops; inode->i_mapping->a_ops = &omfs_aops;
inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
case S_IFDIR: case S_IFDIR:
inode->i_op = &omfs_dir_inops; inode->i_op = &omfs_dir_inops;
@ -134,8 +134,8 @@ static int __omfs_write_inode(struct inode *inode, int wait)
oi->i_head.h_magic = OMFS_IMAGIC; oi->i_head.h_magic = OMFS_IMAGIC;
oi->i_size = cpu_to_be64(inode->i_size); oi->i_size = cpu_to_be64(inode->i_size);
ctime = inode->i_ctime.tv_sec * 1000LL + ctime = inode_get_ctime(inode).tv_sec * 1000LL +
((inode->i_ctime.tv_nsec + 999)/1000); ((inode_get_ctime(inode).tv_nsec + 999)/1000);
oi->i_ctime = cpu_to_be64(ctime); oi->i_ctime = cpu_to_be64(ctime);
omfs_update_checksums(oi); omfs_update_checksums(oi);
@ -232,10 +232,9 @@ struct inode *omfs_iget(struct super_block *sb, ino_t ino)
inode->i_atime.tv_sec = ctime; inode->i_atime.tv_sec = ctime;
inode->i_mtime.tv_sec = ctime; inode->i_mtime.tv_sec = ctime;
inode->i_ctime.tv_sec = ctime; inode_set_ctime(inode, ctime, nsecs);
inode->i_atime.tv_nsec = nsecs; inode->i_atime.tv_nsec = nsecs;
inode->i_mtime.tv_nsec = nsecs; inode->i_mtime.tv_nsec = nsecs;
inode->i_ctime.tv_nsec = nsecs;
inode->i_mapping->a_ops = &omfs_aops; inode->i_mapping->a_ops = &omfs_aops;