Commit a0a415e3 authored by Jeff Layton's avatar Jeff Layton Committed by Christian Brauner

xfs: convert to ctime accessor functions

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: default avatarJeff Layton <jlayton@kernel.org>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Message-Id: <20230705190309.579783-80-jlayton@kernel.org>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 0593be0c
...@@ -222,7 +222,8 @@ xfs_inode_from_disk( ...@@ -222,7 +222,8 @@ xfs_inode_from_disk(
*/ */
inode->i_atime = xfs_inode_from_disk_ts(from, from->di_atime); inode->i_atime = xfs_inode_from_disk_ts(from, from->di_atime);
inode->i_mtime = xfs_inode_from_disk_ts(from, from->di_mtime); inode->i_mtime = xfs_inode_from_disk_ts(from, from->di_mtime);
inode->i_ctime = xfs_inode_from_disk_ts(from, from->di_ctime); inode_set_ctime_to_ts(inode,
xfs_inode_from_disk_ts(from, from->di_ctime));
ip->i_disk_size = be64_to_cpu(from->di_size); ip->i_disk_size = be64_to_cpu(from->di_size);
ip->i_nblocks = be64_to_cpu(from->di_nblocks); ip->i_nblocks = be64_to_cpu(from->di_nblocks);
...@@ -316,7 +317,7 @@ xfs_inode_to_disk( ...@@ -316,7 +317,7 @@ xfs_inode_to_disk(
to->di_atime = xfs_inode_to_disk_ts(ip, inode->i_atime); to->di_atime = xfs_inode_to_disk_ts(ip, inode->i_atime);
to->di_mtime = xfs_inode_to_disk_ts(ip, inode->i_mtime); to->di_mtime = xfs_inode_to_disk_ts(ip, inode->i_mtime);
to->di_ctime = xfs_inode_to_disk_ts(ip, inode->i_ctime); to->di_ctime = xfs_inode_to_disk_ts(ip, inode_get_ctime(inode));
to->di_nlink = cpu_to_be32(inode->i_nlink); to->di_nlink = cpu_to_be32(inode->i_nlink);
to->di_gen = cpu_to_be32(inode->i_generation); to->di_gen = cpu_to_be32(inode->i_generation);
to->di_mode = cpu_to_be16(inode->i_mode); to->di_mode = cpu_to_be16(inode->i_mode);
......
...@@ -67,7 +67,7 @@ xfs_trans_ichgtime( ...@@ -67,7 +67,7 @@ xfs_trans_ichgtime(
if (flags & XFS_ICHGTIME_MOD) if (flags & XFS_ICHGTIME_MOD)
inode->i_mtime = tv; inode->i_mtime = tv;
if (flags & XFS_ICHGTIME_CHG) if (flags & XFS_ICHGTIME_CHG)
inode->i_ctime = tv; inode_set_ctime_to_ts(inode, tv);
if (flags & XFS_ICHGTIME_CREATE) if (flags & XFS_ICHGTIME_CREATE)
ip->i_crtime = tv; ip->i_crtime = tv;
} }
......
...@@ -233,7 +233,7 @@ xfs_acl_set_mode( ...@@ -233,7 +233,7 @@ xfs_acl_set_mode(
xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
inode->i_mode = mode; inode->i_mode = mode;
inode->i_ctime = current_time(inode); inode_set_ctime_current(inode);
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
if (xfs_has_wsync(mp)) if (xfs_has_wsync(mp))
......
...@@ -1644,6 +1644,7 @@ xfs_swap_extents( ...@@ -1644,6 +1644,7 @@ xfs_swap_extents(
uint64_t f; uint64_t f;
int resblks = 0; int resblks = 0;
unsigned int flags = 0; unsigned int flags = 0;
struct timespec64 ctime;
/* /*
* Lock the inodes against other IO, page faults and truncate to * Lock the inodes against other IO, page faults and truncate to
...@@ -1756,8 +1757,9 @@ xfs_swap_extents( ...@@ -1756,8 +1757,9 @@ xfs_swap_extents(
* process that the file was not changed out from * process that the file was not changed out from
* under it. * under it.
*/ */
if ((sbp->bs_ctime.tv_sec != VFS_I(ip)->i_ctime.tv_sec) || ctime = inode_get_ctime(VFS_I(ip));
(sbp->bs_ctime.tv_nsec != VFS_I(ip)->i_ctime.tv_nsec) || if ((sbp->bs_ctime.tv_sec != ctime.tv_sec) ||
(sbp->bs_ctime.tv_nsec != ctime.tv_nsec) ||
(sbp->bs_mtime.tv_sec != VFS_I(ip)->i_mtime.tv_sec) || (sbp->bs_mtime.tv_sec != VFS_I(ip)->i_mtime.tv_sec) ||
(sbp->bs_mtime.tv_nsec != VFS_I(ip)->i_mtime.tv_nsec)) { (sbp->bs_mtime.tv_nsec != VFS_I(ip)->i_mtime.tv_nsec)) {
error = -EBUSY; error = -EBUSY;
......
...@@ -843,10 +843,9 @@ xfs_init_new_inode( ...@@ -843,10 +843,9 @@ xfs_init_new_inode(
ip->i_df.if_nextents = 0; ip->i_df.if_nextents = 0;
ASSERT(ip->i_nblocks == 0); ASSERT(ip->i_nblocks == 0);
tv = current_time(inode); tv = inode_set_ctime_current(inode);
inode->i_mtime = tv; inode->i_mtime = tv;
inode->i_atime = tv; inode->i_atime = tv;
inode->i_ctime = tv;
ip->i_extsize = 0; ip->i_extsize = 0;
ip->i_diflags = 0; ip->i_diflags = 0;
......
...@@ -528,7 +528,7 @@ xfs_inode_to_log_dinode( ...@@ -528,7 +528,7 @@ xfs_inode_to_log_dinode(
memset(to->di_pad3, 0, sizeof(to->di_pad3)); memset(to->di_pad3, 0, sizeof(to->di_pad3));
to->di_atime = xfs_inode_to_log_dinode_ts(ip, inode->i_atime); to->di_atime = xfs_inode_to_log_dinode_ts(ip, inode->i_atime);
to->di_mtime = xfs_inode_to_log_dinode_ts(ip, inode->i_mtime); to->di_mtime = xfs_inode_to_log_dinode_ts(ip, inode->i_mtime);
to->di_ctime = xfs_inode_to_log_dinode_ts(ip, inode->i_ctime); to->di_ctime = xfs_inode_to_log_dinode_ts(ip, inode_get_ctime(inode));
to->di_nlink = inode->i_nlink; to->di_nlink = inode->i_nlink;
to->di_gen = inode->i_generation; to->di_gen = inode->i_generation;
to->di_mode = inode->i_mode; to->di_mode = inode->i_mode;
......
...@@ -574,7 +574,7 @@ xfs_vn_getattr( ...@@ -574,7 +574,7 @@ xfs_vn_getattr(
stat->ino = ip->i_ino; stat->ino = ip->i_ino;
stat->atime = inode->i_atime; stat->atime = inode->i_atime;
stat->mtime = inode->i_mtime; stat->mtime = inode->i_mtime;
stat->ctime = inode->i_ctime; stat->ctime = inode_get_ctime(inode);
stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks); stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks);
if (xfs_has_v3inodes(mp)) { if (xfs_has_v3inodes(mp)) {
...@@ -1055,7 +1055,7 @@ xfs_vn_update_time( ...@@ -1055,7 +1055,7 @@ xfs_vn_update_time(
xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_ilock(ip, XFS_ILOCK_EXCL);
if (flags & S_CTIME) if (flags & S_CTIME)
inode->i_ctime = *now; inode_set_ctime_to_ts(inode, *now);
if (flags & S_MTIME) if (flags & S_MTIME)
inode->i_mtime = *now; inode->i_mtime = *now;
if (flags & S_ATIME) if (flags & S_ATIME)
......
...@@ -100,8 +100,8 @@ xfs_bulkstat_one_int( ...@@ -100,8 +100,8 @@ xfs_bulkstat_one_int(
buf->bs_atime_nsec = inode->i_atime.tv_nsec; buf->bs_atime_nsec = inode->i_atime.tv_nsec;
buf->bs_mtime = inode->i_mtime.tv_sec; buf->bs_mtime = inode->i_mtime.tv_sec;
buf->bs_mtime_nsec = inode->i_mtime.tv_nsec; buf->bs_mtime_nsec = inode->i_mtime.tv_nsec;
buf->bs_ctime = inode->i_ctime.tv_sec; buf->bs_ctime = inode_get_ctime(inode).tv_sec;
buf->bs_ctime_nsec = inode->i_ctime.tv_nsec; buf->bs_ctime_nsec = inode_get_ctime(inode).tv_nsec;
buf->bs_gen = inode->i_generation; buf->bs_gen = inode->i_generation;
buf->bs_mode = inode->i_mode; buf->bs_mode = inode->i_mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment