diff mbox series

[08/26] libxfs: rearrange libxfs_trans_ichgtime call when creating inodes

Message ID 167243875420.723621.13673052362667514239.stgit@magnolia (mailing list archive)
State Superseded, archived
Headers show
Series libxfs: hoist inode operations to libxfs | expand

Commit Message

Darrick J. Wong Dec. 30, 2022, 10:19 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Rearrange the libxfs_trans_ichgtime call in libxfs_ialloc so that we
call it once with the flags we want.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 libxfs/inode.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libxfs/inode.c b/libxfs/inode.c
index 63150422b01..c14a4c5a27f 100644
--- a/libxfs/inode.c
+++ b/libxfs/inode.c
@@ -73,6 +73,7 @@  libxfs_icreate(
 	struct xfs_inode	*pip = args->pip;
 	struct xfs_inode	*ip;
 	unsigned int		flags;
+	int			times = XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG;
 	int			error;
 
 	error = libxfs_iget(tp->t_mountp, tp, ino, 0, &ip);
@@ -84,7 +85,6 @@  libxfs_icreate(
 	set_nlink(VFS_I(ip), args->nlink);
 	VFS_I(ip)->i_uid = args->uid;
 	ip->i_projid = args->prid;
-	xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG | XFS_ICHGTIME_MOD);
 
 	if (pip && (VFS_I(pip)->i_mode & S_ISGID)) {
 		if (!(args->flags & XFS_ICREATE_ARGS_FORCE_GID))
@@ -102,10 +102,12 @@  libxfs_icreate(
 	if (xfs_has_v3inodes(ip->i_mount)) {
 		VFS_I(ip)->i_version = 1;
 		ip->i_diflags2 = ip->i_mount->m_ino_geo.new_diflags2;
-		ip->i_crtime = VFS_I(ip)->i_mtime;
 		ip->i_cowextsize = 0;
+		times |= XFS_ICHGTIME_CREATE;
 	}
 
+	xfs_trans_ichgtime(tp, ip, times);
+
 	flags = XFS_ILOG_CORE;
 	switch (args->mode & S_IFMT) {
 	case S_IFIFO: