Deleted Added
full compact
vfs_export.c (31132) vfs_export.c (31352)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
39 * $Id: vfs_subr.c,v 1.112 1997/11/07 08:53:11 phk Exp $
39 * $Id: vfs_subr.c,v 1.113 1997/11/12 05:42:15 julian Exp $
40 */
41
42/*
43 * External virtual filesystem routines
44 */
45#include "opt_ddb.h"
46#include "opt_devfs.h"
47

--- 17 unchanged lines hidden (view full) ---

65#include <vm/vm_extern.h>
66#include <vm/vnode_pager.h>
67#include <sys/sysctl.h>
68
69#include <miscfs/specfs/specdev.h>
70
71static MALLOC_DEFINE(M_NETADDR, "Export Host", "Export host address structure");
72
40 */
41
42/*
43 * External virtual filesystem routines
44 */
45#include "opt_ddb.h"
46#include "opt_devfs.h"
47

--- 17 unchanged lines hidden (view full) ---

65#include <vm/vm_extern.h>
66#include <vm/vnode_pager.h>
67#include <sys/sysctl.h>
68
69#include <miscfs/specfs/specdev.h>
70
71static MALLOC_DEFINE(M_NETADDR, "Export Host", "Export host address structure");
72
73static void insmntque __P((struct vnode *vp, struct mount *mp));
73#ifdef DDB
74#ifdef DDB
74extern void printlockedvnodes __P((void));
75static void printlockedvnodes __P((void));
75#endif
76#endif
77static void vbusy __P((struct vnode *));
76static void vclean __P((struct vnode *vp, int flags, struct proc *p));
78static void vclean __P((struct vnode *vp, int flags, struct proc *p));
79static void vfree __P((struct vnode *));
77static void vgonel __P((struct vnode *vp, struct proc *p));
80static void vgonel __P((struct vnode *vp, struct proc *p));
78unsigned long numvnodes;
81static unsigned long numvnodes;
79SYSCTL_INT(_debug, OID_AUTO, numvnodes, CTLFLAG_RD, &numvnodes, 0, "");
80static void vputrele __P((struct vnode *vp, int put));
81
82enum vtype iftovt_tab[16] = {
83 VNON, VFIFO, VCHR, VNON, VDIR, VNON, VBLK, VNON,
84 VREG, VNON, VLNK, VNON, VSOCK, VNON, VNON, VBAD,
85};
86int vttoif_tab[9] = {

--- 348 unchanged lines hidden (view full) ---

435 vp->v_usecount = 1;
436 vp->v_data = 0;
437 return (0);
438}
439
440/*
441 * Move a vnode from one mount queue to another.
442 */
82SYSCTL_INT(_debug, OID_AUTO, numvnodes, CTLFLAG_RD, &numvnodes, 0, "");
83static void vputrele __P((struct vnode *vp, int put));
84
85enum vtype iftovt_tab[16] = {
86 VNON, VFIFO, VCHR, VNON, VDIR, VNON, VBLK, VNON,
87 VREG, VNON, VLNK, VNON, VSOCK, VNON, VNON, VBAD,
88};
89int vttoif_tab[9] = {

--- 348 unchanged lines hidden (view full) ---

438 vp->v_usecount = 1;
439 vp->v_data = 0;
440 return (0);
441}
442
443/*
444 * Move a vnode from one mount queue to another.
445 */
443void
446static void
444insmntque(vp, mp)
445 register struct vnode *vp;
446 register struct mount *mp;
447{
448
449 simple_lock(&mntvnode_slock);
450 /*
451 * Delete from old mount point vnode list, if on one.

--- 1060 unchanged lines hidden (view full) ---

1512 }
1513}
1514
1515#ifdef DDB
1516/*
1517 * List all of the locked vnodes in the system.
1518 * Called when debugging the kernel.
1519 */
447insmntque(vp, mp)
448 register struct vnode *vp;
449 register struct mount *mp;
450{
451
452 simple_lock(&mntvnode_slock);
453 /*
454 * Delete from old mount point vnode list, if on one.

--- 1060 unchanged lines hidden (view full) ---

1515 }
1516}
1517
1518#ifdef DDB
1519/*
1520 * List all of the locked vnodes in the system.
1521 * Called when debugging the kernel.
1522 */
1520void
1523static void
1521printlockedvnodes()
1522{
1523 struct proc *p = curproc; /* XXX */
1524 struct mount *mp, *nmp;
1525 struct vnode *vp;
1526
1527 printf("Locked vnodes\n");
1528 simple_lock(&mountlist_slock);

--- 88 unchanged lines hidden (view full) ---

1617 if (error)
1618 return error;
1619 }
1620 return 0;
1621}
1622
1623#endif /* !NO_COMPAT_PRELITE2 */
1624
1524printlockedvnodes()
1525{
1526 struct proc *p = curproc; /* XXX */
1527 struct mount *mp, *nmp;
1528 struct vnode *vp;
1529
1530 printf("Locked vnodes\n");
1531 simple_lock(&mountlist_slock);

--- 88 unchanged lines hidden (view full) ---

1620 if (error)
1621 return error;
1622 }
1623 return 0;
1624}
1625
1626#endif /* !NO_COMPAT_PRELITE2 */
1627
1625int kinfo_vdebug = 1;
1626int kinfo_vgetfailed;
1628static volatile int kinfo_vdebug = 1;
1627
1628#if 0
1629#define KINFO_VNODESLOP 10
1630/*
1631 * Dump vnode list (via sysctl).
1632 * Copyout address of vnode followed by vnode.
1633 */
1634/* ARGSUSED */

--- 443 unchanged lines hidden (view full) ---

2078 }
2079 if (vp->v_object)
2080 vp->v_flag |= VVMIO;
2081
2082retn:
2083 return error;
2084}
2085
1629
1630#if 0
1631#define KINFO_VNODESLOP 10
1632/*
1633 * Dump vnode list (via sysctl).
1634 * Copyout address of vnode followed by vnode.
1635 */
1636/* ARGSUSED */

--- 443 unchanged lines hidden (view full) ---

2080 }
2081 if (vp->v_object)
2082 vp->v_flag |= VVMIO;
2083
2084retn:
2085 return error;
2086}
2087
2086void
2088static void
2087vfree(vp)
2088 struct vnode *vp;
2089{
2090 simple_lock(&vnode_free_list_slock);
2091 if (vp->v_flag & VAGE) {
2092 TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist);
2093 } else {
2094 TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist);
2095 }
2096 freevnodes++;
2097 simple_unlock(&vnode_free_list_slock);
2098 vp->v_flag &= ~VAGE;
2099 vp->v_flag |= VFREE;
2100}
2101
2089vfree(vp)
2090 struct vnode *vp;
2091{
2092 simple_lock(&vnode_free_list_slock);
2093 if (vp->v_flag & VAGE) {
2094 TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist);
2095 } else {
2096 TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist);
2097 }
2098 freevnodes++;
2099 simple_unlock(&vnode_free_list_slock);
2100 vp->v_flag &= ~VAGE;
2101 vp->v_flag |= VFREE;
2102}
2103
2102void
2104static void
2103vbusy(vp)
2104 struct vnode *vp;
2105{
2106 simple_lock(&vnode_free_list_slock);
2107 TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
2108 freevnodes--;
2109 simple_unlock(&vnode_free_list_slock);
2110 vp->v_flag &= ~VFREE;
2111}
2105vbusy(vp)
2106 struct vnode *vp;
2107{
2108 simple_lock(&vnode_free_list_slock);
2109 TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
2110 freevnodes--;
2111 simple_unlock(&vnode_free_list_slock);
2112 vp->v_flag &= ~VFREE;
2113}