Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add VFS_VNODE_PRIVATE protected operations vnalloc_marke...
details: https://anonhg.NetBSD.org/src/rev/9b4a5482269e
branches: trunk
changeset: 345326:9b4a5482269e
user: hannken <hannken%NetBSD.org@localhost>
date: Thu May 19 14:47:33 2016 +0000
description:
Add VFS_VNODE_PRIVATE protected operations vnalloc_marker() to create,
vnfree_marker() to destroy and vnis_marker() to test for marker vnodes.
Make operations vnalloc() and vnfree() local to vfs_vnode.c.
diffstat:
sys/kern/vfs_mount.c | 14 +++++++-------
sys/kern/vfs_vnode.c | 41 +++++++++++++++++++++++++++++++++++++----
sys/sys/vnode.h | 15 +++++++++++----
3 files changed, 55 insertions(+), 15 deletions(-)
diffs (176 lines):
diff -r e3a4c90cc318 -r 9b4a5482269e sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c Thu May 19 08:53:25 2016 +0000
+++ b/sys/kern/vfs_mount.c Thu May 19 14:47:33 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_mount.c,v 1.37 2015/08/19 08:40:02 hannken Exp $ */
+/* $NetBSD: vfs_mount.c,v 1.38 2016/05/19 14:47:33 hannken Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.37 2015/08/19 08:40:02 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.38 2016/05/19 14:47:33 hannken Exp $");
#define _VFS_VNODE_PRIVATE
@@ -346,7 +346,7 @@
{
struct vnode *vp;
- vp = vnalloc(mp);
+ vp = vnalloc_marker(mp);
mutex_enter(&mntvnode_lock);
TAILQ_INSERT_HEAD(&mp->mnt_vnodelist, vp, v_mntvnodes);
@@ -362,13 +362,13 @@
struct vnode *mvp = &vi->vi_vnode;
mutex_enter(&mntvnode_lock);
- KASSERT(ISSET(mvp->v_iflag, VI_MARKER));
+ KASSERT(vnis_marker(mvp));
if (mvp->v_usecount != 0) {
TAILQ_REMOVE(&mvp->v_mount->mnt_vnodelist, mvp, v_mntvnodes);
mvp->v_usecount = 0;
}
mutex_exit(&mntvnode_lock);
- vnfree(mvp);
+ vnfree_marker(mvp);
}
struct vnode *
@@ -380,7 +380,7 @@
struct vnode *vp;
int error;
- KASSERT(ISSET(mvp->v_iflag, VI_MARKER));
+ KASSERT(vnis_marker(mvp));
do {
mutex_enter(&mntvnode_lock);
@@ -393,7 +393,7 @@
return NULL;
}
mutex_enter(vp->v_interlock);
- if (ISSET(vp->v_iflag, VI_MARKER) ||
+ if (vnis_marker(vp) ||
ISSET(vp->v_iflag, VI_XLOCK) ||
(f && !(*f)(cl, vp))) {
mutex_exit(vp->v_interlock);
diff -r e3a4c90cc318 -r 9b4a5482269e sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c Thu May 19 08:53:25 2016 +0000
+++ b/sys/kern/vfs_vnode.c Thu May 19 14:47:33 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_vnode.c,v 1.47 2016/04/22 15:01:54 riastradh Exp $ */
+/* $NetBSD: vfs_vnode.c,v 1.48 2016/05/19 14:47:33 hannken Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -116,7 +116,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.47 2016/04/22 15:01:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.48 2016/05/19 14:47:33 hannken Exp $");
#define _VFS_VNODE_PRIVATE
@@ -195,6 +195,8 @@
static void vrelel(vnode_t *, int);
static void vdrain_thread(void *);
static void vrele_thread(void *);
+static vnode_t * vnalloc(struct mount *);
+static void vnfree(vnode_t *);
static void vnpanic(vnode_t *, const char *, ...)
__printflike(2, 3);
static void vwait(vnode_t *, int);
@@ -236,10 +238,41 @@
}
/*
+ * Allocate a new marker vnode.
+ */
+vnode_t *
+vnalloc_marker(struct mount *mp)
+{
+
+ return vnalloc(mp);
+}
+
+/*
+ * Free a marker vnode.
+ */
+void
+vnfree_marker(vnode_t *vp)
+{
+
+ KASSERT(ISSET(vp->v_iflag, VI_MARKER));
+ vnfree(vp);
+}
+
+/*
+ * Test a vnode for being a marker vnode.
+ */
+bool
+vnis_marker(vnode_t *vp)
+{
+
+ return (ISSET(vp->v_iflag, VI_MARKER));
+}
+
+/*
* Allocate a new, uninitialized vnode. If 'mp' is non-NULL, this is a
* marker vnode.
*/
-vnode_t *
+static vnode_t *
vnalloc(struct mount *mp)
{
vnode_t *vp;
@@ -280,7 +313,7 @@
/*
* Free an unused, unreferenced vnode.
*/
-void
+static void
vnfree(vnode_t *vp)
{
diff -r e3a4c90cc318 -r 9b4a5482269e sys/sys/vnode.h
--- a/sys/sys/vnode.h Thu May 19 08:53:25 2016 +0000
+++ b/sys/sys/vnode.h Thu May 19 14:47:33 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vnode.h,v 1.259 2016/01/23 16:08:20 christos Exp $ */
+/* $NetBSD: vnode.h,v 1.260 2016/05/19 14:47:33 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -546,9 +546,6 @@
void vwakeup(struct buf *);
int vdead_check(struct vnode *, int);
void vrevoke(struct vnode *);
-struct vnode *
- vnalloc(struct mount *);
-void vnfree(struct vnode *);
void vremfree(struct vnode *);
int vcache_get(struct mount *, const void *, size_t, struct vnode **);
int vcache_new(struct mount *, struct vnode *,
@@ -605,6 +602,16 @@
__printflike(1, 2));
#endif /* DDB */
+#ifdef _VFS_VNODE_PRIVATE
+/*
+ * Private vnode manipulation functions.
+ */
+struct vnode *
+ vnalloc_marker(struct mount *);
+void vnfree_marker(vnode_t *);
+bool vnis_marker(vnode_t *);
+#endif /* _VFS_VNODE_PRIVATE */
+
#endif /* _KERNEL */
#endif /* !_SYS_VNODE_H_ */
Home |
Main Index |
Thread Index |
Old Index