diff mbox series

[v2,20/89] bcachefs: convert to new timestamp accessors

Message ID 20231004185347.80880-18-jlayton@kernel.org (mailing list archive)
State New, archived
Headers show
Series fs: new accessor methods for inode atime and mtime | expand

Commit Message

Jeff Layton Oct. 4, 2023, 6:52 p.m. UTC
Convert to using the new inode timestamp accessor functions.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/bcachefs/fs.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Brian Foster Oct. 5, 2023, 12:08 p.m. UTC | #1
On Wed, Oct 04, 2023 at 02:52:05PM -0400, Jeff Layton wrote:
> Convert to using the new inode timestamp accessor functions.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---

Acked-by: Brian Foster <bfoster@redhat.com>

>  fs/bcachefs/fs.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
> index 09137a20449b..1fbaad27d07b 100644
> --- a/fs/bcachefs/fs.c
> +++ b/fs/bcachefs/fs.c
> @@ -66,9 +66,9 @@ void bch2_inode_update_after_write(struct btree_trans *trans,
>  	inode->v.i_mode	= bi->bi_mode;
>  
>  	if (fields & ATTR_ATIME)
> -		inode->v.i_atime = bch2_time_to_timespec(c, bi->bi_atime);
> +		inode_set_atime_to_ts(&inode->v, bch2_time_to_timespec(c, bi->bi_atime));
>  	if (fields & ATTR_MTIME)
> -		inode->v.i_mtime = bch2_time_to_timespec(c, bi->bi_mtime);
> +		inode_set_mtime_to_ts(&inode->v, bch2_time_to_timespec(c, bi->bi_mtime));
>  	if (fields & ATTR_CTIME)
>  		inode_set_ctime_to_ts(&inode->v, bch2_time_to_timespec(c, bi->bi_ctime));
>  
> @@ -753,8 +753,8 @@ static int bch2_getattr(struct mnt_idmap *idmap,
>  	stat->gid	= inode->v.i_gid;
>  	stat->rdev	= inode->v.i_rdev;
>  	stat->size	= i_size_read(&inode->v);
> -	stat->atime	= inode->v.i_atime;
> -	stat->mtime	= inode->v.i_mtime;
> +	stat->atime	= inode_get_atime(&inode->v);
> +	stat->mtime	= inode_get_mtime(&inode->v);
>  	stat->ctime	= inode_get_ctime(&inode->v);
>  	stat->blksize	= block_bytes(c);
>  	stat->blocks	= inode->v.i_blocks;
> @@ -1418,8 +1418,8 @@ static int inode_update_times_fn(struct btree_trans *trans,
>  {
>  	struct bch_fs *c = inode->v.i_sb->s_fs_info;
>  
> -	bi->bi_atime	= timespec_to_bch2_time(c, inode->v.i_atime);
> -	bi->bi_mtime	= timespec_to_bch2_time(c, inode->v.i_mtime);
> +	bi->bi_atime	= timespec_to_bch2_time(c, inode_get_atime(&inode->v));
> +	bi->bi_mtime	= timespec_to_bch2_time(c, inode_get_mtime(&inode->v));
>  	bi->bi_ctime	= timespec_to_bch2_time(c, inode_get_ctime(&inode->v));
>  
>  	return 0;
> -- 
> 2.41.0
>
diff mbox series

Patch

diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 09137a20449b..1fbaad27d07b 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -66,9 +66,9 @@  void bch2_inode_update_after_write(struct btree_trans *trans,
 	inode->v.i_mode	= bi->bi_mode;
 
 	if (fields & ATTR_ATIME)
-		inode->v.i_atime = bch2_time_to_timespec(c, bi->bi_atime);
+		inode_set_atime_to_ts(&inode->v, bch2_time_to_timespec(c, bi->bi_atime));
 	if (fields & ATTR_MTIME)
-		inode->v.i_mtime = bch2_time_to_timespec(c, bi->bi_mtime);
+		inode_set_mtime_to_ts(&inode->v, bch2_time_to_timespec(c, bi->bi_mtime));
 	if (fields & ATTR_CTIME)
 		inode_set_ctime_to_ts(&inode->v, bch2_time_to_timespec(c, bi->bi_ctime));
 
@@ -753,8 +753,8 @@  static int bch2_getattr(struct mnt_idmap *idmap,
 	stat->gid	= inode->v.i_gid;
 	stat->rdev	= inode->v.i_rdev;
 	stat->size	= i_size_read(&inode->v);
-	stat->atime	= inode->v.i_atime;
-	stat->mtime	= inode->v.i_mtime;
+	stat->atime	= inode_get_atime(&inode->v);
+	stat->mtime	= inode_get_mtime(&inode->v);
 	stat->ctime	= inode_get_ctime(&inode->v);
 	stat->blksize	= block_bytes(c);
 	stat->blocks	= inode->v.i_blocks;
@@ -1418,8 +1418,8 @@  static int inode_update_times_fn(struct btree_trans *trans,
 {
 	struct bch_fs *c = inode->v.i_sb->s_fs_info;
 
-	bi->bi_atime	= timespec_to_bch2_time(c, inode->v.i_atime);
-	bi->bi_mtime	= timespec_to_bch2_time(c, inode->v.i_mtime);
+	bi->bi_atime	= timespec_to_bch2_time(c, inode_get_atime(&inode->v));
+	bi->bi_mtime	= timespec_to_bch2_time(c, inode_get_mtime(&inode->v));
 	bi->bi_ctime	= timespec_to_bch2_time(c, inode_get_ctime(&inode->v));
 
 	return 0;