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
This commit is contained in:
Konstantin Belousov
2026-05-09 22:14:56 +03:00
parent da6aa0648c
commit 64467d2ec3
3 changed files with 8 additions and 8 deletions
+2 -3
View File
@@ -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);
+2 -2
View File
@@ -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);
}
+4 -3
View File
@@ -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); \