Re: [PATCH v2 35/92] devpts: convert to ctime accessor functions

From: Jan Kara
Date: Thu Jul 06 2023 - 06:57:28 EST


On Wed 05-07-23 15:01:00, Jeff Layton wrote:
> 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.
>
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

Honza

> ---
> fs/devpts/inode.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
> index fe3db0eda8e4..5ede89880911 100644
> --- a/fs/devpts/inode.c
> +++ b/fs/devpts/inode.c
> @@ -338,7 +338,7 @@ static int mknod_ptmx(struct super_block *sb)
> }
>
> inode->i_ino = 2;
> - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
> + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
>
> mode = S_IFCHR|opts->ptmxmode;
> init_special_inode(inode, mode, MKDEV(TTYAUX_MAJOR, 2));
> @@ -451,7 +451,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
> if (!inode)
> goto fail;
> inode->i_ino = 1;
> - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
> + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
> inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
> inode->i_op = &simple_dir_inode_operations;
> inode->i_fop = &simple_dir_operations;
> @@ -560,7 +560,7 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
> inode->i_ino = index + 3;
> inode->i_uid = opts->setuid ? opts->uid : current_fsuid();
> inode->i_gid = opts->setgid ? opts->gid : current_fsgid();
> - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
> + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
> init_special_inode(inode, S_IFCHR|opts->mode, MKDEV(UNIX98_PTY_SLAVE_MAJOR, index));
>
> sprintf(s, "%d", index);
> --
> 2.41.0
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR