aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-05-09 19:14:56 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-06-14 02:08:20 +0000
commit64467d2ec3ede11430554fea68b317d27bf4b5c3 (patch)
tree146713195ebdaa07c64bb03da7d567ea33474120
parentda6aa0648c0265d6f7bcba44a26f13ed0453dd7a (diff)
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
-rw-r--r--sys/kern/vfs_subr.c5
-rw-r--r--sys/sys/mount.h4
-rw-r--r--sys/sys/vnode.h7
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); \