Re: [PATCH v2 65/92] orangefs: convert to ctime accessor functions

From: Jan Kara
Date: Thu Jul 06 2023 - 09:56:43 EST


On Wed 05-07-23 15:01:30, 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/orangefs/namei.c | 2 +-
> fs/orangefs/orangefs-utils.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c
> index 77518e248cf7..c9dfd5c6a097 100644
> --- a/fs/orangefs/namei.c
> +++ b/fs/orangefs/namei.c
> @@ -421,7 +421,7 @@ static int orangefs_rename(struct mnt_idmap *idmap,
> ret);
>
> if (new_dentry->d_inode)
> - new_dentry->d_inode->i_ctime = current_time(new_dentry->d_inode);
> + inode_set_ctime_current(d_inode(new_dentry));
>
> op_release(new_op);
> return ret;
> diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c
> index 46b7dcff18ac..0a9fcfdf552f 100644
> --- a/fs/orangefs/orangefs-utils.c
> +++ b/fs/orangefs/orangefs-utils.c
> @@ -361,11 +361,11 @@ int orangefs_inode_getattr(struct inode *inode, int flags)
> downcall.resp.getattr.attributes.atime;
> inode->i_mtime.tv_sec = (time64_t)new_op->
> downcall.resp.getattr.attributes.mtime;
> - inode->i_ctime.tv_sec = (time64_t)new_op->
> - downcall.resp.getattr.attributes.ctime;
> + inode_set_ctime(inode,
> + (time64_t)new_op->downcall.resp.getattr.attributes.ctime,
> + 0);
> inode->i_atime.tv_nsec = 0;
> inode->i_mtime.tv_nsec = 0;
> - inode->i_ctime.tv_nsec = 0;
>
> /* special case: mark the root inode as sticky */
> inode->i_mode = type | (is_root_handle(inode) ? S_ISVTX : 0) |
> --
> 2.41.0
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR