diff options
author | phk <phk@FreeBSD.org> | 2004-12-07 08:15:41 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-12-07 08:15:41 +0000 |
commit | 4a639d6164f667049cce0046d22e760ca1aad3f2 (patch) | |
tree | 8a677b8e6580c00ab014aebc4c8dc33107ab26f3 /sys/kern/vfs_subr.c | |
parent | b183fa653bf444f02ca3966a2ba789e50318ee0c (diff) | |
download | FreeBSD-src-4a639d6164f667049cce0046d22e760ca1aad3f2.zip FreeBSD-src-4a639d6164f667049cce0046d22e760ca1aad3f2.tar.gz |
The remaining part of nmount/omount/rootfs mount changes. I cannot sensibly
split the conversion of the remaining three filesystems out from the root
mounting changes, so in one go:
cd9660:
Convert to nmount.
Add omount compat shims.
Remove dedicated rootfs mounting code.
Use vfs_mountedfrom()
Rely on vfs_mount.c calling VFS_STATFS()
nfs(client):
Convert to nmount (the simple way, mount_nfs(8) is still necessary).
Add omount compat shims.
Drop COMPAT_PRELITE2 mount arg compatibility.
ffs:
Convert to nmount.
Add omount compat shims.
Remove dedicated rootfs mounting code.
Use vfs_mountedfrom()
Rely on vfs_mount.c calling VFS_STATFS()
Remove vfs_omount() method, all filesystems are now converted.
Remove MNTK_WANTRDWR, handling RO/RW conversions is a filesystem
task, and they all do it now.
Change rootmounting to use DEVFS trampoline:
vfs_mount.c:
Mount devfs on /. Devfs needs no 'from' so this is clean.
symlink /dev to /. This makes it possible to lookup /dev/foo.
Mount "real" root filesystem on /.
Surgically move the devfs mountpoint from under the real root
filesystem onto /dev in the real root filesystem.
Remove now unnecessary getdiskbyname().
kern_init.c:
Don't do devfs mounting and rootvnode assignment here, it was
already handled by vfs_mount.c.
Remove now unused bdevvp(), addaliasu() and addalias(). Put the
few necessary lines in devfs where they belong. This eliminates the
second-last source of bogo vnodes, leaving only the lemming-syncer.
Remove rootdev variable, it doesn't give meaning in a global context and
was not trustworth anyway. Correct information is provided by
statfs(/).
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index e083aa7..8323091 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -79,7 +79,6 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_NETADDR, "Export Host", "Export host address structure"); -static void addalias(struct vnode *vp, struct cdev *nvp_rdev); static void delmntque(struct vnode *vp); static void insmntque(struct vnode *vp, struct mount *mp); static void vclean(struct vnode *vp, int flags, struct thread *td); @@ -1752,39 +1751,6 @@ reassignbuf(struct buf *bp) VI_UNLOCK(vp); } -/* - * Create a vnode for a device. - * Used for mounting the root filesystem. - */ -int -bdevvp(dev, vpp) - struct cdev *dev; - struct vnode **vpp; -{ - register struct vnode *vp; - struct vnode *nvp; - int error; - - if (dev == NULL) { - *vpp = NULLVP; - return (ENXIO); - } - if (vfinddev(dev, vpp)) - return (0); - - error = getnewvnode("none", (struct mount *)0, &devfs_specops, &nvp); - if (error) { - *vpp = NULLVP; - return (error); - } - vp = nvp; - vp->v_type = VCHR; - vp->v_bufobj.bo_bsize = DEV_BSIZE; - addalias(vp, dev); - *vpp = vp; - return (0); -} - static void v_incr_usecount(struct vnode *vp, int delta) { @@ -1798,86 +1764,6 @@ v_incr_usecount(struct vnode *vp, int delta) } /* - * Add vnode to the alias list hung off the struct cdev *. - * - * The reason for this gunk is that multiple vnodes can reference - * the same physical device, so checking vp->v_usecount to see - * how many users there are is inadequate; the v_usecount for - * the vnodes need to be accumulated. vcount() does that. - */ -struct vnode * -addaliasu(nvp, nvp_rdev) - struct vnode *nvp; - dev_t nvp_rdev; -{ - struct vnode *ovp; - struct vop_vector *ops; - struct cdev *dev; - - if (nvp->v_type == VBLK) - return (nvp); - if (nvp->v_type != VCHR) - panic("addaliasu on non-special vnode"); - dev = findcdev(nvp_rdev); - if (dev == NULL) - return (nvp); - /* - * Check to see if we have a bdevvp vnode with no associated - * filesystem. If so, we want to associate the filesystem of - * the new newly instigated vnode with the bdevvp vnode and - * discard the newly created vnode rather than leaving the - * bdevvp vnode lying around with no associated filesystem. - */ - if (vfinddev(dev, &ovp) == 0 || ovp->v_data != NULL) { - addalias(nvp, dev); - return (nvp); - } - /* - * Discard unneeded vnode, but save its node specific data. - * Note that if there is a lock, it is carried over in the - * node specific data to the replacement vnode. - */ - vref(ovp); - ovp->v_data = nvp->v_data; - ovp->v_tag = nvp->v_tag; - nvp->v_data = NULL; - lockdestroy(ovp->v_vnlock); - lockinit(ovp->v_vnlock, PVFS, nvp->v_vnlock->lk_wmesg, - nvp->v_vnlock->lk_timo, nvp->v_vnlock->lk_flags & LK_EXTFLG_MASK); - ops = ovp->v_op; - ovp->v_op = nvp->v_op; - if (VOP_ISLOCKED(nvp, curthread)) { - VOP_UNLOCK(nvp, 0, curthread); - vn_lock(ovp, LK_EXCLUSIVE | LK_RETRY, curthread); - } - nvp->v_op = ops; - delmntque(ovp); - insmntque(ovp, nvp->v_mount); - vrele(nvp); - vgone(nvp); - return (ovp); -} - -/* This is a local helper function that do the same as addaliasu, but for a - * struct cdev *instead of an dev_t. */ -static void -addalias(nvp, dev) - struct vnode *nvp; - struct cdev *dev; -{ - - KASSERT(nvp->v_type == VCHR, ("addalias on non-special vnode")); - VI_LOCK(nvp); - dev_lock(); - dev->si_refcount++; - nvp->v_rdev = dev; - SLIST_INSERT_HEAD(&dev->si_hlist, nvp, v_specnext); - dev->si_usecount += nvp->v_usecount; - dev_unlock(); - VI_UNLOCK(nvp); -} - -/* * Grab a particular vnode from the free list, increment its * reference count and lock it. The vnode lock bit is set if the * vnode is being eliminated in vgone. The process is awakened |