Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/mfs Change mfs to use an anonymous vnode obtained wi...



details:   https://anonhg.NetBSD.org/src/rev/5231f0188909
branches:  trunk
changeset: 805700:5231f0188909
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Jan 14 11:21:31 2015 +0000

description:
Change mfs to use an anonymous vnode obtained with bdevvp()
for the specdev it mounts on.

diffstat:

 sys/ufs/mfs/mfs_vfsops.c |  23 +++++++++++++++--------
 sys/ufs/mfs/mfs_vnops.c  |  10 +++++-----
 2 files changed, 20 insertions(+), 13 deletions(-)

diffs (99 lines):

diff -r 4f777597cec3 -r 5231f0188909 sys/ufs/mfs/mfs_vfsops.c
--- a/sys/ufs/mfs/mfs_vfsops.c  Wed Jan 14 09:29:27 2015 +0000
+++ b/sys/ufs/mfs/mfs_vfsops.c  Wed Jan 14 11:21:31 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mfs_vfsops.c,v 1.108 2014/05/08 08:21:53 hannken Exp $ */
+/*     $NetBSD: mfs_vfsops.c,v 1.109 2015/01/14 11:21:31 hannken Exp $ */
 
 /*
  * Copyright (c) 1989, 1990, 1993, 1994
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.108 2014/05/08 08:21:53 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.109 2015/01/14 11:21:31 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -71,7 +71,7 @@
 kmutex_t mfs_lock;     /* global lock */
 
 /* used for building internal dev_t, minor == 0 reserved for miniroot */
-static int mfs_minor = 1;
+static devminor_t mfs_minor = 1;
 static int mfs_initcnt;
 
 extern int (**mfs_vnodeop_p)(void *);
@@ -246,6 +246,7 @@
        struct fs *fs;
        struct mfsnode *mfsp;
        struct proc *p;
+       devminor_t minor;
        int flags, error = 0;
 
        if (args == NULL)
@@ -307,14 +308,20 @@
                        return EINVAL;
                return (0);
        }
-       error = getnewvnode(VT_MFS, NULL, mfs_vnodeop_p, NULL, &devvp);
+       mutex_enter(&mfs_lock);
+       minor = mfs_minor++;
+       mutex_exit(&mfs_lock);
+       error = bdevvp(makedev(255, minor), &devvp);
        if (error)
                return (error);
-       devvp->v_vflag |= VV_MPSAFE;
-       devvp->v_type = VBLK;
-       spec_node_init(devvp, makedev(255, mfs_minor));
-       mfs_minor++;
        mfsp = kmem_alloc(sizeof(*mfsp), KM_SLEEP);
+       /*
+        * Changing v_op and v_data here is safe as we are
+        * the exclusive owner of this device node.
+        */
+       KASSERT(devvp->v_op == spec_vnodeop_p);
+       KASSERT(devvp->v_data == NULL);
+       devvp->v_op = mfs_vnodeop_p;
        devvp->v_data = mfsp;
        mfsp->mfs_baseoff = args->base;
        mfsp->mfs_size = args->size;
diff -r 4f777597cec3 -r 5231f0188909 sys/ufs/mfs/mfs_vnops.c
--- a/sys/ufs/mfs/mfs_vnops.c   Wed Jan 14 09:29:27 2015 +0000
+++ b/sys/ufs/mfs/mfs_vnops.c   Wed Jan 14 11:21:31 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mfs_vnops.c,v 1.55 2014/07/25 08:20:53 dholland Exp $  */
+/*     $NetBSD: mfs_vnops.c,v 1.56 2015/01/14 11:21:31 hannken Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfs_vnops.c,v 1.55 2014/07/25 08:20:53 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfs_vnops.c,v 1.56 2015/01/14 11:21:31 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -280,8 +280,8 @@
        if (bufq_peek(mfsp->mfs_buflist) != NULL)
                panic("mfs_inactive: not inactive (mfs_buflist %p)",
                        bufq_peek(mfsp->mfs_buflist));
-       VOP_UNLOCK(vp);
-       return (0);
+
+       return VOCALL(spec_vnodeop_p,  VOFFSET(vop_inactive), ap);
 }
 
 /*
@@ -308,7 +308,7 @@
                kmem_free(mfsp, sizeof(*mfsp));
        }
 
-       return (0);
+       return VOCALL(spec_vnodeop_p,  VOFFSET(vop_reclaim), ap);
 }
 
 /*



Home | Main Index | Thread Index | Old Index