2023-06-21 15:09:56

by Jeff Layton

[permalink] [raw]
Subject: [PATCH 11/79] afs: switch to new ctime accessors

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

Signed-off-by: Jeff Layton <[email protected]>
---
fs/afs/dynroot.c | 2 +-
fs/afs/inode.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
index d7d9402ff718..ee36375de337 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -88,9 +88,9 @@ struct inode *afs_iget_pseudo_dir(struct super_block *sb, bool root)
set_nlink(inode, 2);
inode->i_uid = GLOBAL_ROOT_UID;
inode->i_gid = GLOBAL_ROOT_GID;
- inode->i_ctime = inode->i_atime = inode->i_mtime = current_time(inode);
inode->i_blocks = 0;
inode->i_generation = 0;
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);

set_bit(AFS_VNODE_PSEUDODIR, &vnode->flags);
if (!root) {
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 866bab860a88..0b59903c2a43 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -90,7 +90,7 @@ static int afs_inode_init_from_status(struct afs_operation *op,
vnode->status = *status;

t = status->mtime_client;
- inode->i_ctime = t;
+ inode_ctime_set(inode, t);
inode->i_mtime = t;
inode->i_atime = t;
inode->i_flags |= S_NOATIME;
@@ -206,7 +206,7 @@ static void afs_apply_status(struct afs_operation *op,
t = status->mtime_client;
inode->i_mtime = t;
if (vp->update_ctime)
- inode->i_ctime = op->ctime;
+ inode_ctime_set(inode, op->ctime);

if (vnode->status.data_version != status->data_version)
data_changed = true;
@@ -252,7 +252,7 @@ static void afs_apply_status(struct afs_operation *op,
vnode->netfs.remote_i_size = status->size;
if (change_size) {
afs_set_i_size(vnode, status->size);
- inode->i_ctime = t;
+ inode_ctime_set(inode, t);
inode->i_atime = t;
}
}
--
2.41.0



2023-06-21 16:54:30

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH 11/79] afs: switch to new ctime accessors

On Wed 21-06-23 10:45:24, Jeff Layton wrote:
> In later patches, we're going to change how the ctime.tv_nsec field is
> utilized. Switch to using accessor functions instead of raw accesses of
> inode->i_ctime.
>
> Signed-off-by: Jeff Layton <[email protected]>

Looks good to me. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/afs/dynroot.c | 2 +-
> fs/afs/inode.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
> index d7d9402ff718..ee36375de337 100644
> --- a/fs/afs/dynroot.c
> +++ b/fs/afs/dynroot.c
> @@ -88,9 +88,9 @@ struct inode *afs_iget_pseudo_dir(struct super_block *sb, bool root)
> set_nlink(inode, 2);
> inode->i_uid = GLOBAL_ROOT_UID;
> inode->i_gid = GLOBAL_ROOT_GID;
> - inode->i_ctime = inode->i_atime = inode->i_mtime = current_time(inode);
> inode->i_blocks = 0;
> inode->i_generation = 0;
> + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
>
> set_bit(AFS_VNODE_PSEUDODIR, &vnode->flags);
> if (!root) {
> diff --git a/fs/afs/inode.c b/fs/afs/inode.c
> index 866bab860a88..0b59903c2a43 100644
> --- a/fs/afs/inode.c
> +++ b/fs/afs/inode.c
> @@ -90,7 +90,7 @@ static int afs_inode_init_from_status(struct afs_operation *op,
> vnode->status = *status;
>
> t = status->mtime_client;
> - inode->i_ctime = t;
> + inode_ctime_set(inode, t);
> inode->i_mtime = t;
> inode->i_atime = t;
> inode->i_flags |= S_NOATIME;
> @@ -206,7 +206,7 @@ static void afs_apply_status(struct afs_operation *op,
> t = status->mtime_client;
> inode->i_mtime = t;
> if (vp->update_ctime)
> - inode->i_ctime = op->ctime;
> + inode_ctime_set(inode, op->ctime);
>
> if (vnode->status.data_version != status->data_version)
> data_changed = true;
> @@ -252,7 +252,7 @@ static void afs_apply_status(struct afs_operation *op,
> vnode->netfs.remote_i_size = status->size;
> if (change_size) {
> afs_set_i_size(vnode, status->size);
> - inode->i_ctime = t;
> + inode_ctime_set(inode, t);
> inode->i_atime = t;
> }
> }
> --
> 2.41.0
>
--
Jan Kara <[email protected]>
SUSE Labs, CR