Page MenuHomeFreeBSD

D56912.diff
No OneTemporary

D56912.diff

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -6662,7 +6662,7 @@
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);
}
@@ -6712,8 +6712,7 @@
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
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -967,7 +967,7 @@
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_LOCKED(&vp->v_pollinfo->vpi_selinfo.si_note,
hint);
}
@@ -976,7 +976,7 @@
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_UNLOCKED(&vp->v_pollinfo->vpi_selinfo.si_note,
hint);
}
diff --git a/sys/sys/rangelock.h b/sys/sys/rangelock.h
--- a/sys/sys/rangelock.h
+++ b/sys/sys/rangelock.h
@@ -46,10 +46,20 @@
* all existing lock owners are compatible with the request. Two lock
* owners are compatible if their ranges do not overlap, or both
* owners are for read.
+ *
+ * The resvX fields are there due to padding and explicitly enumerated
+ * so they can be used by consumers. For instance, struct vnode uses
+ * resv1 as v_type and resv2 as v_state.
*/
struct rangelock {
uintptr_t head;
bool sleepers;
+ uint8_t resv1;
+ uint8_t resv2;
+ uint8_t resv3;
+#if __SIZEOF_LONG__ >= 8
+ uint32_t resv4;
+#endif
};
#ifdef _KERNEL
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -133,8 +133,7 @@
* Fields which define the identity of the vnode. These fields are
* owned by the filesystem (XXX: and vgone() ?)
*/
- __enum_uint8(vtype) v_type; /* u vnode type */
- __enum_uint8(vstate) v_state; /* u vnode state */
+ short v_v2flag; /* v frequently read flag */
short v_irflag; /* i frequently read flags */
seqc_t v_seqc; /* i modification count */
uint32_t v_nchash; /* u namecache hash */
@@ -203,6 +202,12 @@
(negative) text users */
int v_seqc_users; /* i modifications pending */
};
+/*
+ __enum_uint8(vtype) v_type;
+ __enum_uint8(vstate) v_state;
+*/
+#define v_type v_rl.resv1 /* u vnode type */
+#define v_state v_rl.resv2 /* u vnode state */
#define VN_ISDEV(vp) VTYPE_ISDEV((vp)->v_type)
@@ -224,7 +229,7 @@
#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); \
} \
@@ -237,6 +242,7 @@
* VI flags are protected by interlock and live in v_iflag
* VIRF flags are protected by interlock and live in v_irflag
* VV flags are protected by the vnode lock and live in v_vflag
+ * V2 flags are protected by the vnode lock and live in v_v2flag
*
* VIRF_DOOMED is doubly protected by the interlock and vnode lock. Both
* are required for writing but the status may be checked with either.
@@ -255,7 +261,8 @@
#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 */
@@ -1048,7 +1055,7 @@
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); \

File Metadata

Mime Type
text/plain
Expires
Wed, May 20, 4:19 PM (12 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33325638
Default Alt Text
D56912.diff (3 KB)

Event Timeline