git: 60457d1ea068 - stable/13 - ufs: try to elide the interlock in ufs_itimes

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Thu, 24 Aug 2023 23:30:40 UTC
The branch stable/13 has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=60457d1ea0680dfec0efa80832339a7b4fa96160

commit 60457d1ea0680dfec0efa80832339a7b4fa96160
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-09-12 23:20:59 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-08-24 23:30:34 +0000

    ufs: try to elide the interlock in ufs_itimes
    
    Reviewed by:    kib, mckusick
    Differential Revision:  https://reviews.freebsd.org/D36522
    
    (cherry picked from commit 04f095a49165cf4903fda0f21271be5c6bfa5857)
---
 sys/ufs/ufs/ufs_vnops.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 8eeb3ac84f6b..a6ca523ae87c 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -188,6 +188,11 @@ ufs_itimes_locked(struct vnode *vp)
 void
 ufs_itimes(struct vnode *vp)
 {
+	struct inode *ip;
+
+	ip = VTOI(vp);
+	if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) == 0)
+		return;
 
 	VI_LOCK(vp);
 	ufs_itimes_locked(vp);