From: Darrick J. Wong Date: Wed, 3 Jul 2024 21:21:33 +0000 (-0700) Subject: xfs: implement atime updates in xfs_trans_ichgtime X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=87db9904a53730a24cf63cb7a190feb4d4acab17;p=users%2Fhch%2Fxfsprogs.git xfs: implement atime updates in xfs_trans_ichgtime Enable xfs_trans_ichgtime to change the inode access time so that we can use this function to set inode times when allocating inodes instead of open-coding it. Signed-off-by: Darrick J. Wong --- diff --git a/libxfs/xfs_shared.h b/libxfs/xfs_shared.h index 34f104ed3..9a705381f 100644 --- a/libxfs/xfs_shared.h +++ b/libxfs/xfs_shared.h @@ -183,6 +183,7 @@ void xfs_log_get_max_trans_res(struct xfs_mount *mp, #define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */ #define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */ #define XFS_ICHGTIME_CREATE 0x4 /* inode create timestamp */ +#define XFS_ICHGTIME_ACCESS 0x8 /* last access timestamp */ /* Computed inode geometry for the filesystem. */ struct xfs_ino_geometry { diff --git a/libxfs/xfs_trans_inode.c b/libxfs/xfs_trans_inode.c index f8484eb20..45b513bc5 100644 --- a/libxfs/xfs_trans_inode.c +++ b/libxfs/xfs_trans_inode.c @@ -65,6 +65,8 @@ xfs_trans_ichgtime( inode_set_mtime_to_ts(inode, tv); if (flags & XFS_ICHGTIME_CHG) inode_set_ctime_to_ts(inode, tv); + if (flags & XFS_ICHGTIME_ACCESS) + inode_set_atime_to_ts(inode, tv); if (flags & XFS_ICHGTIME_CREATE) ip->i_crtime = tv; }