aboutsummaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-07-02 11:22:36 -0700
committerDarrick J. Wong <djwong@kernel.org>2024-07-02 11:36:56 -0700
commita7b12718cb90188bc1a062d6cbb9d9a3f790e20a (patch)
tree6d55fde6d8526617b855c9a2fbe37651e6e9aced /fs/xfs/xfs_inode.c
parent3d1dfb6df9b7b9ffc95499b9ddd92d949e5a60d2 (diff)
xfs: use xfs_trans_ichgtime to set times when allocating inode
Use xfs_trans_ichgtime to set the inode times when allocating an inode, instead of open-coding them here. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 4f13ad0fa14e..59e76759e41f 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -672,10 +672,11 @@ xfs_icreate(
struct inode *dir = pip ? VFS_I(pip) : NULL;
struct xfs_mount *mp = tp->t_mountp;
struct xfs_inode *ip;
+ struct inode *inode;
unsigned int flags;
+ int times = XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG |
+ XFS_ICHGTIME_ACCESS;
int error;
- struct timespec64 tv;
- struct inode *inode;
/*
* Protect against obviously corrupt allocation btree records. Later
@@ -743,19 +744,17 @@ xfs_icreate(
ip->i_df.if_nextents = 0;
ASSERT(ip->i_nblocks == 0);
- tv = inode_set_ctime_current(inode);
- inode_set_mtime_to_ts(inode, tv);
- inode_set_atime_to_ts(inode, tv);
-
ip->i_extsize = 0;
ip->i_diflags = 0;
if (xfs_has_v3inodes(mp)) {
inode_set_iversion(inode, 1);
ip->i_cowextsize = 0;
- ip->i_crtime = tv;
+ times |= XFS_ICHGTIME_CREATE;
}
+ xfs_trans_ichgtime(tp, ip, times);
+
flags = XFS_ILOG_CORE;
switch (args->mode & S_IFMT) {
case S_IFIFO: