From: Darrick J. Wong Date: Tue, 9 Jan 2024 17:39:35 +0000 (-0800) Subject: libxfs: rearrange libxfs_trans_ichgtime call when creating inodes X-Git-Tag: xfs-zoned-old-2024-06-10~301 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d09b2c57de5677bcb00f1824c14883ed063a654f;p=users%2Fhch%2Fxfsprogs.git libxfs: rearrange libxfs_trans_ichgtime call when creating inodes 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 --- diff --git a/libxfs/inode.c b/libxfs/inode.c index 38531609c..326c88a42 100644 --- a/libxfs/inode.c +++ b/libxfs/inode.c @@ -91,6 +91,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, XFS_IGET_CREATE, &ip); @@ -102,7 +103,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)) @@ -120,10 +120,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 = inode_get_mtime(VFS_I(ip)); /* struct copy */ 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: