[13/79] autofs: switch to new ctime accessors

Message ID 20230621144735.55953-12-jlayton@kernel.org
State New
Headers
Series None |

Commit Message

Jeff Layton June 21, 2023, 2:45 p.m. UTC
  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 <jlayton@kernel.org>
---
 fs/autofs/inode.c | 2 +-
 fs/autofs/root.c  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Jan Kara June 21, 2023, 4:43 p.m. UTC | #1
On Wed 21-06-23 10:45:26, 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 <jlayton@kernel.org>

Looks good to me. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/autofs/inode.c | 2 +-
>  fs/autofs/root.c  | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
> index affa70360b1f..47e3054b29dc 100644
> --- a/fs/autofs/inode.c
> +++ b/fs/autofs/inode.c
> @@ -370,7 +370,7 @@ struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
>  		inode->i_uid = d_inode(sb->s_root)->i_uid;
>  		inode->i_gid = d_inode(sb->s_root)->i_gid;
>  	}
> -	inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> +	inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
>  	inode->i_ino = get_next_ino();
>  
>  	if (S_ISDIR(mode)) {
> diff --git a/fs/autofs/root.c b/fs/autofs/root.c
> index 93046c9dc461..4c0fc0f8d688 100644
> --- a/fs/autofs/root.c
> +++ b/fs/autofs/root.c
> @@ -600,7 +600,7 @@ static int autofs_dir_symlink(struct mnt_idmap *idmap,
>  	p_ino = autofs_dentry_ino(dentry->d_parent);
>  	p_ino->count++;
>  
> -	dir->i_mtime = dir->i_ctime = current_time(dir);
> +	dir->i_mtime = inode_ctime_set_current(dir);
>  
>  	return 0;
>  }
> @@ -633,7 +633,7 @@ static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry)
>  	d_inode(dentry)->i_size = 0;
>  	clear_nlink(d_inode(dentry));
>  
> -	dir->i_mtime = dir->i_ctime = current_time(dir);
> +	dir->i_mtime = inode_ctime_set_current(dir);
>  
>  	spin_lock(&sbi->lookup_lock);
>  	__autofs_add_expiring(dentry);
> @@ -749,7 +749,7 @@ static int autofs_dir_mkdir(struct mnt_idmap *idmap,
>  	p_ino = autofs_dentry_ino(dentry->d_parent);
>  	p_ino->count++;
>  	inc_nlink(dir);
> -	dir->i_mtime = dir->i_ctime = current_time(dir);
> +	dir->i_mtime = inode_ctime_set_current(dir);
>  
>  	return 0;
>  }
> -- 
> 2.41.0
>
  
Ian Kent June 27, 2023, 1:48 a.m. UTC | #2
On 21/623 22:45, 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 <jlayton@kernel.org>

Looks fine to me.

Please feel free to add my Acked-by or even Signed-off-by as

you need dictates.


Ian

> ---
>   fs/autofs/inode.c | 2 +-
>   fs/autofs/root.c  | 6 +++---
>   2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
> index affa70360b1f..47e3054b29dc 100644
> --- a/fs/autofs/inode.c
> +++ b/fs/autofs/inode.c
> @@ -370,7 +370,7 @@ struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
>   		inode->i_uid = d_inode(sb->s_root)->i_uid;
>   		inode->i_gid = d_inode(sb->s_root)->i_gid;
>   	}
> -	inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> +	inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
>   	inode->i_ino = get_next_ino();
>   
>   	if (S_ISDIR(mode)) {
> diff --git a/fs/autofs/root.c b/fs/autofs/root.c
> index 93046c9dc461..4c0fc0f8d688 100644
> --- a/fs/autofs/root.c
> +++ b/fs/autofs/root.c
> @@ -600,7 +600,7 @@ static int autofs_dir_symlink(struct mnt_idmap *idmap,
>   	p_ino = autofs_dentry_ino(dentry->d_parent);
>   	p_ino->count++;
>   
> -	dir->i_mtime = dir->i_ctime = current_time(dir);
> +	dir->i_mtime = inode_ctime_set_current(dir);
>   
>   	return 0;
>   }
> @@ -633,7 +633,7 @@ static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry)
>   	d_inode(dentry)->i_size = 0;
>   	clear_nlink(d_inode(dentry));
>   
> -	dir->i_mtime = dir->i_ctime = current_time(dir);
> +	dir->i_mtime = inode_ctime_set_current(dir);
>   
>   	spin_lock(&sbi->lookup_lock);
>   	__autofs_add_expiring(dentry);
> @@ -749,7 +749,7 @@ static int autofs_dir_mkdir(struct mnt_idmap *idmap,
>   	p_ino = autofs_dentry_ino(dentry->d_parent);
>   	p_ino->count++;
>   	inc_nlink(dir);
> -	dir->i_mtime = dir->i_ctime = current_time(dir);
> +	dir->i_mtime = inode_ctime_set_current(dir);
>   
>   	return 0;
>   }
  

Patch

diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index affa70360b1f..47e3054b29dc 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -370,7 +370,7 @@  struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
 		inode->i_uid = d_inode(sb->s_root)->i_uid;
 		inode->i_gid = d_inode(sb->s_root)->i_gid;
 	}
-	inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+	inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
 	inode->i_ino = get_next_ino();
 
 	if (S_ISDIR(mode)) {
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 93046c9dc461..4c0fc0f8d688 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -600,7 +600,7 @@  static int autofs_dir_symlink(struct mnt_idmap *idmap,
 	p_ino = autofs_dentry_ino(dentry->d_parent);
 	p_ino->count++;
 
-	dir->i_mtime = dir->i_ctime = current_time(dir);
+	dir->i_mtime = inode_ctime_set_current(dir);
 
 	return 0;
 }
@@ -633,7 +633,7 @@  static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry)
 	d_inode(dentry)->i_size = 0;
 	clear_nlink(d_inode(dentry));
 
-	dir->i_mtime = dir->i_ctime = current_time(dir);
+	dir->i_mtime = inode_ctime_set_current(dir);
 
 	spin_lock(&sbi->lookup_lock);
 	__autofs_add_expiring(dentry);
@@ -749,7 +749,7 @@  static int autofs_dir_mkdir(struct mnt_idmap *idmap,
 	p_ino = autofs_dentry_ino(dentry->d_parent);
 	p_ino->count++;
 	inc_nlink(dir);
-	dir->i_mtime = dir->i_ctime = current_time(dir);
+	dir->i_mtime = inode_ctime_set_current(dir);
 
 	return 0;
 }