git: 64467d2ec3ed - main - vnode: move VIRF_KNOTE to v_v2flag

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 14 Jun 2026 02:10:34 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=64467d2ec3ede11430554fea68b317d27bf4b5c3

commit 64467d2ec3ede11430554fea68b317d27bf4b5c3
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-05-09 19:14:56 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-06-14 02:08:20 +0000

    vnode: move VIRF_KNOTE to v_v2flag
    
    The semantic of the flag has the natural march to the code scope that is
    protected by the vnode lock.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D56912
---
 sys/kern/vfs_subr.c | 5 ++---
 sys/sys/mount.h     | 4 ++--
 sys/sys/vnode.h     | 7 ++++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 7b2718269a1f..64c11660e211 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -6675,7 +6675,7 @@ vfs_knlunlock(void *arg)
 	struct vnode *vp = arg;
 
 	if (KNLIST_EMPTY(&vp->v_pollinfo->vpi_selinfo.si_note))
-		vn_irflag_unset(vp, VIRF_KNOTE);
+		vp->v_v2flag &= ~V2_KNOTE;
 	VOP_UNLOCK(vp);
 }
 
@@ -6725,8 +6725,7 @@ vfs_kqfilter(struct vop_kqfilter_args *ap)
 	vhold(vp);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	knlist_add(knl, kn, 1);
-	if ((vn_irflag_read(vp) & VIRF_KNOTE) == 0)
-		vn_irflag_set(vp, VIRF_KNOTE);
+	vp->v_v2flag |= V2_KNOTE;
 	VOP_UNLOCK(vp);
 
 	return (0);
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 2e880bac9068..fa4c98d93bf8 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -967,7 +967,7 @@ VFS_PURGE(struct mount *mp)
 static inline void
 VFS_KNOTE_LOCKED(struct vnode *vp, int hint)
 {
-	if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) {
+	if ((vp->v_v2flag & V2_KNOTE) != 0) {
 		KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note,
 		    hint, KNF_LISTLOCKED | KNF_NOKQLOCK);
 	}
@@ -976,7 +976,7 @@ VFS_KNOTE_LOCKED(struct vnode *vp, int hint)
 static inline void
 VFS_KNOTE_UNLOCKED(struct vnode *vp, int hint)
 {
-	if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) {
+	if ((vp->v_v2flag & V2_KNOTE) != 0) {
 		KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note,
 		    hint, KNF_NOKQLOCK);
 	}
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 51def7a861ec..8077e7741ec3 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -229,7 +229,7 @@ _Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes");
 #define v_object	v_bufobj.bo_object
 
 #define VN_KNOTE(vp, b, a) do {                    			\
-	if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) {			\
+	if ((vp->v_v2flag & V2_KNOTE) != 0) {			\
 		KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note, (b),	\
 		    (a) | KNF_NOKQLOCK);				\
 	}								\
@@ -261,7 +261,8 @@ _Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes");
 #define	VIRF_INOTIFY	0x0080	/* This vnode is being watched */
 #define	VIRF_INOTIFY_PARENT 0x0100 /* A parent of this vnode may be being
 				      watched */
-#define	VIRF_KNOTE	0x0200	/* Has knlist */
+
+#define	V2_KNOTE	0x0001	/* Has knlist */
 
 #define	VI_UNUSED0	0x0001	/* unused */
 #define	VI_MOUNT	0x0002	/* Mount in progress */
@@ -1055,7 +1056,7 @@ void	vop_rename_fail(struct vop_rename_args *ap);
 	off_t osize, ooffset, noffset;					\
 									\
 	osize = ooffset = noffset = 0;					\
-	if ((vn_irflag_read((ap)->a_vp) & VIRF_KNOTE) != 0) {		\
+	if (((ap)->a_vp->v_v2flag & V2_KNOTE) != 0) {			\
 		error = VOP_GETATTR((ap)->a_vp, &va, (ap)->a_cred);	\
 		if (error)						\
 			return (error);					\