[Cluster-devel] [PATCH v2 47/92] gfs2: convert to ctime accessor functions

2023-07-05 Thread Jeff Layton
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 
---
 fs/gfs2/acl.c   |  2 +-
 fs/gfs2/bmap.c  | 11 +--
 fs/gfs2/dir.c   | 15 ---
 fs/gfs2/file.c  |  2 +-
 fs/gfs2/glops.c |  4 ++--
 fs/gfs2/inode.c |  8 
 fs/gfs2/super.c |  4 ++--
 fs/gfs2/xattr.c |  8 
 8 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index a392aa0f041d..443640e6fb9c 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -142,7 +142,7 @@ int gfs2_set_acl(struct mnt_idmap *idmap, struct dentry 
*dentry,
 
ret = __gfs2_set_acl(inode, acl, type);
if (!ret && mode != inode->i_mode) {
-   inode->i_ctime = current_time(inode);
+   inode_set_ctime_current(inode);
inode->i_mode = mode;
mark_inode_dirty(inode);
}
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 8d611fbcf0bd..45ea63f7167d 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1386,7 +1386,7 @@ static int trunc_start(struct inode *inode, u64 newsize)
ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG;
 
i_size_write(inode, newsize);
-   ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
+   ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
gfs2_dinode_out(ip, dibh->b_data);
 
if (journaled)
@@ -1583,8 +1583,7 @@ static int sweep_bh_for_rgrps(struct gfs2_inode *ip, 
struct gfs2_holder *rd_gh,
 
/* Every transaction boundary, we rewrite the dinode
   to keep its di_blocks current in case of failure. */
-   ip->i_inode.i_mtime = ip->i_inode.i_ctime =
-   current_time(&ip->i_inode);
+   ip->i_inode.i_mtime = 
inode_set_ctime_current(&ip->i_inode);
gfs2_trans_add_meta(ip->i_gl, dibh);
gfs2_dinode_out(ip, dibh->b_data);
brelse(dibh);
@@ -1950,7 +1949,7 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, 
u64 length)
gfs2_statfs_change(sdp, 0, +btotal, 0);
gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid,
  ip->i_inode.i_gid);
-   ip->i_inode.i_mtime = ip->i_inode.i_ctime = 
current_time(&ip->i_inode);
+   ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
gfs2_trans_add_meta(ip->i_gl, dibh);
gfs2_dinode_out(ip, dibh->b_data);
up_write(&ip->i_rw_mutex);
@@ -1993,7 +1992,7 @@ static int trunc_end(struct gfs2_inode *ip)
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
gfs2_ordered_del_inode(ip);
}
-   ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
+   ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG;
 
gfs2_trans_add_meta(ip->i_gl, dibh);
@@ -2094,7 +2093,7 @@ static int do_grow(struct inode *inode, u64 size)
goto do_end_trans;
 
truncate_setsize(inode, size);
-   ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
+   ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
gfs2_trans_add_meta(ip->i_gl, dibh);
gfs2_dinode_out(ip, dibh->b_data);
brelse(dibh);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 54a6d17b8c25..1a2afa88f8be 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -130,7 +130,7 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, 
const char *buf,
memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size);
if (ip->i_inode.i_size < offset + size)
i_size_write(&ip->i_inode, offset + size);
-   ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
+   ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
gfs2_dinode_out(ip, dibh->b_data);
 
brelse(dibh);
@@ -227,7 +227,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const 
char *buf,
 
if (ip->i_inode.i_size < offset + copied)
i_size_write(&ip->i_inode, offset + copied);
-   ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
+   ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
 
gfs2_trans_add_meta(ip->i_gl, dibh);
gfs2_dinode_out(ip, dibh->b_data);
@@ -1814,7 +1814,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr 
*name,
gfs2_inum_out(nip, dent);
dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode));
dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip));
-   tv = current_time(&ip->i_inode);
+

Re: [Cluster-devel] [PATCH v2 47/92] gfs2: convert to ctime accessor functions

2023-07-06 Thread Jan Kara
On Wed 05-07-23 15:01:12, 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 

Looks good to me. Feel free to add:

Reviewed-by: Jan Kara 

Honza

> ---
>  fs/gfs2/acl.c   |  2 +-
>  fs/gfs2/bmap.c  | 11 +--
>  fs/gfs2/dir.c   | 15 ---
>  fs/gfs2/file.c  |  2 +-
>  fs/gfs2/glops.c |  4 ++--
>  fs/gfs2/inode.c |  8 
>  fs/gfs2/super.c |  4 ++--
>  fs/gfs2/xattr.c |  8 
>  8 files changed, 27 insertions(+), 27 deletions(-)
> 
> diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
> index a392aa0f041d..443640e6fb9c 100644
> --- a/fs/gfs2/acl.c
> +++ b/fs/gfs2/acl.c
> @@ -142,7 +142,7 @@ int gfs2_set_acl(struct mnt_idmap *idmap, struct dentry 
> *dentry,
>  
>   ret = __gfs2_set_acl(inode, acl, type);
>   if (!ret && mode != inode->i_mode) {
> - inode->i_ctime = current_time(inode);
> + inode_set_ctime_current(inode);
>   inode->i_mode = mode;
>   mark_inode_dirty(inode);
>   }
> diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
> index 8d611fbcf0bd..45ea63f7167d 100644
> --- a/fs/gfs2/bmap.c
> +++ b/fs/gfs2/bmap.c
> @@ -1386,7 +1386,7 @@ static int trunc_start(struct inode *inode, u64 newsize)
>   ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG;
>  
>   i_size_write(inode, newsize);
> - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
> + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
>   gfs2_dinode_out(ip, dibh->b_data);
>  
>   if (journaled)
> @@ -1583,8 +1583,7 @@ static int sweep_bh_for_rgrps(struct gfs2_inode *ip, 
> struct gfs2_holder *rd_gh,
>  
>   /* Every transaction boundary, we rewrite the dinode
>  to keep its di_blocks current in case of failure. */
> - ip->i_inode.i_mtime = ip->i_inode.i_ctime =
> - current_time(&ip->i_inode);
> + ip->i_inode.i_mtime = 
> inode_set_ctime_current(&ip->i_inode);
>   gfs2_trans_add_meta(ip->i_gl, dibh);
>   gfs2_dinode_out(ip, dibh->b_data);
>   brelse(dibh);
> @@ -1950,7 +1949,7 @@ static int punch_hole(struct gfs2_inode *ip, u64 
> offset, u64 length)
>   gfs2_statfs_change(sdp, 0, +btotal, 0);
>   gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid,
> ip->i_inode.i_gid);
> - ip->i_inode.i_mtime = ip->i_inode.i_ctime = 
> current_time(&ip->i_inode);
> + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
>   gfs2_trans_add_meta(ip->i_gl, dibh);
>   gfs2_dinode_out(ip, dibh->b_data);
>   up_write(&ip->i_rw_mutex);
> @@ -1993,7 +1992,7 @@ static int trunc_end(struct gfs2_inode *ip)
>   gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
>   gfs2_ordered_del_inode(ip);
>   }
> - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
> + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
>   ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG;
>  
>   gfs2_trans_add_meta(ip->i_gl, dibh);
> @@ -2094,7 +2093,7 @@ static int do_grow(struct inode *inode, u64 size)
>   goto do_end_trans;
>  
>   truncate_setsize(inode, size);
> - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
> + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
>   gfs2_trans_add_meta(ip->i_gl, dibh);
>   gfs2_dinode_out(ip, dibh->b_data);
>   brelse(dibh);
> diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
> index 54a6d17b8c25..1a2afa88f8be 100644
> --- a/fs/gfs2/dir.c
> +++ b/fs/gfs2/dir.c
> @@ -130,7 +130,7 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, 
> const char *buf,
>   memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size);
>   if (ip->i_inode.i_size < offset + size)
>   i_size_write(&ip->i_inode, offset + size);
> - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
> + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
>   gfs2_dinode_out(ip, dibh->b_data);
>  
>   brelse(dibh);
> @@ -227,7 +227,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, 
> const char *buf,
>  
>   if (ip->i_inode.i_size < offset + copied)
>   i_size_write(&ip->i_inode, offset + copied);
> - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
> + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
>  
>   gfs2_trans_add_meta(ip->i_gl, dibh);
>   gfs2_dinode_out(ip, dibh->b_data);
> @@ -1814,7 +1814,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr 
> *name