]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: rearrange libxfs_trans_ichgtime call when creating inodes
authorDarrick J. Wong <djwong@kernel.org>
Wed, 2 Oct 2024 01:10:58 +0000 (18:10 -0700)
committerAndrey Albershteyn <aalbersh@redhat.com>
Fri, 4 Oct 2024 10:42:07 +0000 (12:42 +0200)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/inode.c

index 9ccc22adffdf17f15bf9716e20aa3bfd70562423..b302bbbfd3ba7b829478468fbf7182bbdc9ef89f 100644 (file)
@@ -94,6 +94,7 @@ libxfs_icreate(
        struct inode            *inode;
        struct xfs_inode        *ip;
        unsigned int            flags;
+       int                     times = XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG;
        int                     error;
 
        error = libxfs_iget(mp, tp, ino, XFS_IGET_CREATE, &ip);
@@ -112,7 +113,6 @@ libxfs_icreate(
        inode->i_uid = GLOBAL_ROOT_UID;
        inode->i_gid = GLOBAL_ROOT_GID;
        ip->i_projid = 0;
-       xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG | XFS_ICHGTIME_MOD);
 
        if (pip && (dir->i_mode & S_ISGID)) {
                inode->i_gid = dir->i_gid;
@@ -129,10 +129,12 @@ libxfs_icreate(
        if (xfs_has_v3inodes(ip->i_mount)) {
                inode->i_version = 1;
                ip->i_diflags2 = ip->i_mount->m_ino_geo.new_diflags2;
-               ip->i_crtime = inode_get_mtime(inode); /* 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: