diff options
Diffstat (limited to 'sys/kern/vfs_subr.c')
| -rw-r--r-- | sys/kern/vfs_subr.c | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index e0d9d1201431..024c5679000b 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,11 @@ /* + * Copyright (c) UNIX System Laboratories, Inc. All or some portions + * of this file are derived from material licensed to the + * University of California by American Telephone and Telegraph Co. + * or UNIX System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + */ +/* * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. * @@ -31,7 +38,7 @@ * SUCH DAMAGE. * * from: @(#)vfs_subr.c 7.60 (Berkeley) 6/21/91 - * $Id: vfs_subr.c,v 1.4 1993/10/18 14:22:16 davidg Exp $ + * $Id: vfs_subr.c,v 1.7.2.2 1994/05/04 07:55:00 rgrimes Exp $ */ /* @@ -39,6 +46,7 @@ */ #include "param.h" +#include "systm.h" #include "proc.h" #include "mount.h" #include "time.h" @@ -50,6 +58,10 @@ #include "errno.h" #include "malloc.h" +static void insmntque(struct vnode *, struct mount *); + +struct vnode *speclisth[SPECHSZ]; /* device special file vnode hash table */ + /* * Remove a mount point from the list of mounted filesystems. * Unmount of the root is illegal. @@ -71,13 +83,14 @@ vfs_remove(mp) * Lock a filesystem. * Used to prevent access to it while mounting and unmounting. */ +int vfs_lock(mp) register struct mount *mp; { while(mp->mnt_flag & MNT_MLOCK) { mp->mnt_flag |= MNT_MWAIT; - sleep((caddr_t)mp, PVFS); + tsleep((caddr_t)mp, PVFS, "vfslock", 0); } mp->mnt_flag |= MNT_MLOCK; return (0); @@ -105,13 +118,14 @@ vfs_unlock(mp) * Mark a mount point as busy. * Used to synchronize access and to delay unmounting. */ +int vfs_busy(mp) register struct mount *mp; { while(mp->mnt_flag & MNT_MPBUSY) { mp->mnt_flag |= MNT_MPWANT; - sleep((caddr_t)&mp->mnt_flag, PVFS); + tsleep((caddr_t)&mp->mnt_flag, PVFS, "vfsbusy", 0); } if (mp->mnt_flag & MNT_UNMOUNT) return (1); @@ -123,6 +137,7 @@ vfs_busy(mp) * Free a busy filesystem. * Panic if filesystem is not busy. */ +void vfs_unbusy(mp) register struct mount *mp; { @@ -179,13 +194,13 @@ void vattr_null(vap) */ struct vnode *vfreeh, **vfreet; extern struct vnodeops dead_vnodeops, spec_vnodeops; -extern void vclean(); long numvnodes; struct vattr va_null; /* * Initialize the vnode structures and initialize each file system type. */ +void vfsinit() { struct vfsops **vfsp; @@ -208,6 +223,7 @@ vfsinit() /* * Return the next vnode from the free list. */ +int getnewvnode(tag, mp, vops, vpp) enum vtagtype tag; struct mount *mp; @@ -255,6 +271,7 @@ getnewvnode(tag, mp, vops, vpp) /* * Move a vnode from one mount queue to another. */ +static void insmntque(vp, mp) register struct vnode *vp; register struct mount *mp; @@ -289,6 +306,7 @@ insmntque(vp, mp) * Make sure all write-behind blocks associated * with mount point are flushed out (from sync). */ +void mntflushbuf(mountp, flags) struct mount *mountp; int flags; @@ -313,6 +331,7 @@ loop: /* * Flush all dirty buffers associated with a vnode. */ +void vflushbuf(vp, flags) register struct vnode *vp; int flags; @@ -350,7 +369,7 @@ loop: s = splbio(); while (vp->v_numoutput) { vp->v_flag |= VBWAIT; - sleep((caddr_t)&vp->v_numoutput, PRIBIO + 1); + tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 1, "vflushbf", 0); } splx(s); if (vp->v_dirtyblkhd) { @@ -362,6 +381,7 @@ loop: /* * Update outstanding I/O count and do wakeup if requested. */ +void vwakeup(bp) register struct buf *bp; { @@ -388,6 +408,7 @@ vwakeup(bp) * filesystem there will be no dirty buffers when we are done. Binval * returns the count of dirty buffers when it is finished. */ +int mntinvalbuf(mountp) struct mount *mountp; { @@ -412,6 +433,7 @@ loop: * Flush out and invalidate all buffers associated with a vnode. * Called with the underlying object locked. */ +int vinvalbuf(vp, save) register struct vnode *vp; int save; @@ -432,7 +454,7 @@ vinvalbuf(vp, save) s = splbio(); if (bp->b_flags & B_BUSY) { bp->b_flags |= B_WANTED; - sleep((caddr_t)bp, PRIBIO + 1); + tsleep((caddr_t)bp, PRIBIO + 1, "vinvalbf", 0); splx(s); break; } @@ -459,6 +481,7 @@ vinvalbuf(vp, save) /* * Associate a buffer with a vnode. */ +void bgetvp(vp, bp) register struct vnode *vp; register struct buf *bp; @@ -487,6 +510,7 @@ bgetvp(vp, bp) /* * Disassociate a buffer from a vnode. */ +void brelvp(bp) register struct buf *bp; { @@ -515,6 +539,7 @@ brelvp(bp) * Used to assign file specific control information * (indirect blocks) to the vnode to which they belong. */ +void reassignbuf(bp, newvp) register struct buf *bp; register struct vnode *newvp; @@ -551,6 +576,7 @@ reassignbuf(bp, newvp) * Used for root filesystem, argdev, and swap areas. * Also used for memory file system special devices. */ +int bdevvp(dev, vpp) dev_t dev; struct vnode **vpp; @@ -644,6 +670,7 @@ loop: * indicate that the vnode is no longer usable (possibly having * been changed to a new file system type). */ +int vget(vp) register struct vnode *vp; { @@ -651,7 +678,7 @@ vget(vp) if (vp->v_flag & VXLOCK) { vp->v_flag |= VXWANT; - sleep((caddr_t)vp, PINOD); + tsleep((caddr_t)vp, PINOD, "vget", 0); return (1); } if (vp->v_usecount == 0) { @@ -710,6 +737,7 @@ void vrele(vp) panic("vrele: ref cnt"); } #endif + vp->v_writecount = 0; /* XXX */ if (vfreeh == NULLVP) { /* * insert into empty list @@ -731,6 +759,7 @@ void vrele(vp) /* * Page or buffer structure gets a reference. */ +void vhold(vp) register struct vnode *vp; { @@ -741,6 +770,7 @@ vhold(vp) /* * Page or buffer structure frees a reference. */ +void holdrele(vp) register struct vnode *vp; { @@ -760,6 +790,7 @@ holdrele(vp) */ int busyprt = 0; /* patch to print out busy vnodes */ +int vflush(mp, skipvp, flags) struct mount *mp; struct vnode *skipvp; @@ -902,7 +933,7 @@ void vgoneall(vp) */ if (vp->v_flag & VXLOCK) { vp->v_flag |= VXWANT; - sleep((caddr_t)vp, PINOD); + tsleep((caddr_t)vp, PINOD, "vgoneall", 0); return; } /* @@ -933,11 +964,12 @@ void vgoneall(vp) * Eliminate all activity associated with a vnode * in preparation for reuse. */ -void vgone(vp) +void +vgone(vp) register struct vnode *vp; { register struct vnode *vq; - struct vnode *vx; + struct vnode *vx = 0; long count; /* @@ -946,7 +978,7 @@ void vgone(vp) */ if (vp->v_flag & VXLOCK) { vp->v_flag |= VXWANT; - sleep((caddr_t)vp, PINOD); + tsleep((caddr_t)vp, PINOD, "vgone", 0); return; } /* @@ -1017,6 +1049,7 @@ void vgone(vp) /* * Lookup a vnode by device number. */ +int vfinddev(dev, type, vpp) dev_t dev; enum vtype type; @@ -1036,6 +1069,7 @@ vfinddev(dev, type, vpp) /* * Calculate the total number of references to a special device. */ +int vcount(vp) register struct vnode *vp; { @@ -1066,8 +1100,9 @@ loop: static char *typename[] = { "VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD" }; +void vprint(label, vp) - char *label; + const char *label; register struct vnode *vp; { char buf[64]; @@ -1127,6 +1162,7 @@ int kinfo_vgetfailed; * Copyout address of vnode followed by vnode. */ /* ARGSUSED */ +int kinfo_vnode(op, where, acopysize, arg, aneeded) int op; char *where; |
