Turn mountlist into a CIRCLEQ, and handle setting and checking of MNT_ROOTFS
differently.
This commit is contained in:
parent
40073dc687
commit
9843f45605
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vfs_subr.c,v 1.37 1995/01/15 09:23:05 cgd Exp $ */
|
||||
/* $NetBSD: vfs_subr.c,v 1.38 1995/01/18 06:24:21 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -94,7 +94,7 @@ vntblinit()
|
|||
{
|
||||
|
||||
TAILQ_INIT(&vnode_free_list);
|
||||
TAILQ_INIT(&mountlist);
|
||||
CIRCLEQ_INIT(&mountlist);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -175,7 +175,8 @@ getvfs(fsid)
|
|||
{
|
||||
register struct mount *mp;
|
||||
|
||||
for (mp = mountlist.tqh_first; mp != NULL; mp = mp->mnt_list.tqe_next)
|
||||
for (mp = mountlist.cqh_first; mp != (void *)&mountlist;
|
||||
mp = mp->mnt_list.cqe_next)
|
||||
if (mp->mnt_stat.f_fsid.val[0] == fsid->val[0] &&
|
||||
mp->mnt_stat.f_fsid.val[1] == fsid->val[1])
|
||||
return (mp);
|
||||
|
@ -200,7 +201,7 @@ getnewfsid(mp, mtype)
|
|||
++xxxfs_mntid;
|
||||
tfsid.val[0] = makedev((nblkdev + mtype) & 0xff, xxxfs_mntid);
|
||||
tfsid.val[1] = mtype;
|
||||
if (mountlist.tqh_first != NULL) {
|
||||
if (mountlist.cqh_first != (void *)&mountlist) {
|
||||
while (getvfs(&tfsid)) {
|
||||
tfsid.val[0]++;
|
||||
xxxfs_mntid++;
|
||||
|
@ -1161,7 +1162,8 @@ printlockedvnodes()
|
|||
register struct vnode *vp;
|
||||
|
||||
printf("Locked vnodes\n");
|
||||
for (mp = mountlist.tqh_first; mp != NULL; mp = mp->mnt_list.tqe_next) {
|
||||
for (mp = mountlist.cqh_first; mp != (void *)&mountlist;
|
||||
mp = mp->mnt_list.cqe_next) {
|
||||
for (vp = mp->mnt_vnodelist.lh_first;
|
||||
vp != NULL;
|
||||
vp = vp->v_mntvnodes.le_next)
|
||||
|
@ -1197,8 +1199,8 @@ sysctl_vnode(where, sizep)
|
|||
}
|
||||
ewhere = where + *sizep;
|
||||
|
||||
for (mp = mountlist.tqh_first; mp != NULL; mp = nmp) {
|
||||
nmp = mp->mnt_list.tqe_next;
|
||||
for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) {
|
||||
nmp = mp->mnt_list.cqe_next;
|
||||
if (vfs_busy(mp))
|
||||
continue;
|
||||
savebp = bp;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_vfsops.c,v 1.10 1994/12/15 19:49:44 mycroft Exp $ */
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.11 1995/01/18 06:19:49 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1994
|
||||
|
@ -116,8 +116,7 @@ ffs_mountroot()
|
|||
free(mp, M_MOUNT);
|
||||
return (error);
|
||||
}
|
||||
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
|
||||
mp->mnt_flag |= MNT_ROOTFS;
|
||||
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
|
||||
mp->mnt_vnodecovered = NULLVP;
|
||||
ump = VFSTOUFS(mp);
|
||||
fs = ump->um_fs;
|
||||
|
@ -540,11 +539,8 @@ ffs_unmount(mp, mntflags, p)
|
|||
int error, flags;
|
||||
|
||||
flags = 0;
|
||||
if (mntflags & MNT_FORCE) {
|
||||
if (mp->mnt_flag & MNT_ROOTFS)
|
||||
return (EINVAL);
|
||||
if (mntflags & MNT_FORCE)
|
||||
flags |= FORCECLOSE;
|
||||
}
|
||||
if (error = ffs_flushfiles(mp, flags, p))
|
||||
return (error);
|
||||
ump = VFSTOUFS(mp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_bio.c,v 1.2 1994/06/29 06:46:52 cgd Exp $ */
|
||||
/* $NetBSD: lfs_bio.c,v 1.3 1995/01/18 06:19:52 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -141,7 +141,8 @@ lfs_flush()
|
|||
if (lfs_writing)
|
||||
return;
|
||||
lfs_writing = 1;
|
||||
for (mp = mountlist.tqh_first; mp != NULL; mp = mp->mnt_list.tqe_next) {
|
||||
for (mp = mountlist.cqh_first; mp != (void *)&mountlist;
|
||||
mp = mp->mnt_list.cqe_next) {
|
||||
/* The lock check below is to avoid races with unmount. */
|
||||
if (!strcmp(&mp->mnt_stat.f_fstypename[0], MOUNT_LFS) &&
|
||||
(mp->mnt_flag & (MNT_MLOCK|MNT_RDONLY|MNT_UNMOUNT)) == 0 &&
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lfs_vfsops.c,v 1.4 1994/12/15 19:51:06 mycroft Exp $ */
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.5 1995/01/18 06:19:53 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1994
|
||||
|
@ -347,11 +347,8 @@ lfs_unmount(mp, mntflags, p)
|
|||
int i, error, flags, ronly;
|
||||
|
||||
flags = 0;
|
||||
if (mntflags & MNT_FORCE) {
|
||||
if (!doforce || (mp->mnt_flag & MNT_ROOTFS))
|
||||
return (EINVAL);
|
||||
if (mntflags & MNT_FORCE)
|
||||
flags |= FORCECLOSE;
|
||||
}
|
||||
|
||||
ump = VFSTOUFS(mp);
|
||||
fs = ump->um_lfs;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mfs_vfsops.c,v 1.3 1994/12/15 19:51:39 mycroft Exp $ */
|
||||
/* $NetBSD: mfs_vfsops.c,v 1.4 1995/01/18 06:19:54 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1990, 1993, 1994
|
||||
|
@ -130,8 +130,7 @@ mfs_mountroot()
|
|||
free(mfsp, M_MFSNODE);
|
||||
return (error);
|
||||
}
|
||||
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
|
||||
mp->mnt_flag |= MNT_ROOTFS;
|
||||
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
|
||||
mp->mnt_vnodecovered = NULLVP;
|
||||
ump = VFSTOUFS(mp);
|
||||
fs = ump->um_fs;
|
||||
|
|
|
@ -39,7 +39,7 @@ static char copyright[] =
|
|||
|
||||
#ifndef lint
|
||||
/* from: static char sccsid[] = "@(#)pstat.c 8.9 (Berkeley) 2/16/94"; */
|
||||
static char *rcsid = "$Id: pstat.c,v 1.8 1995/01/15 07:08:57 mycroft Exp $";
|
||||
static char *rcsid = "$Id: pstat.c,v 1.9 1995/01/18 06:27:32 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -693,8 +693,7 @@ kinfo_vnodes(avnodes)
|
|||
bp = vbuf;
|
||||
evbuf = vbuf + (numvnodes + 20) * (VPTRSZ + VNODESZ);
|
||||
KGET(V_MOUNTLIST, mountlist);
|
||||
for (num = 0, mp = mountlist.tqh_first;
|
||||
mp != NULL; mp = mp->mnt_list.tqe_next) {
|
||||
for (num = 0, mp = mountlist.cqh_first; ; mp = mp->mnt_list.cqe_next) {
|
||||
KGET2(mp, &mount, sizeof(mount), "mount entry");
|
||||
for (vp = mount.mnt_vnodelist.lh_first;
|
||||
vp != NULL; vp = vp->v_mntvnodes.le_next) {
|
||||
|
@ -708,6 +707,8 @@ kinfo_vnodes(avnodes)
|
|||
bp += VNODESZ;
|
||||
num++;
|
||||
}
|
||||
if (mp == mountlist.cqh_last)
|
||||
break;
|
||||
}
|
||||
*avnodes = num;
|
||||
return ((struct e_vnode *)vbuf);
|
||||
|
|
Loading…
Reference in New Issue