Converted mountlist to a CIRCLEQ.

Partially obtained from: 4.4BSD-Lite2
This commit is contained in:
David Greenman 1995-08-11 11:31:18 +00:00
parent 48b9e85079
commit 628641f8a6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10027
14 changed files with 61 additions and 63 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.3 (Berkeley) 1/31/94
* $Id: cd9660_vfsops.c,v 1.12 1995/05/19 03:25:35 davidg Exp $
* $Id: cd9660_vfsops.c,v 1.13 1995/05/30 08:05:03 rgrimes Exp $
*/
#include <sys/param.h>
@ -113,7 +113,7 @@ cd9660_mountroot()
free(mp, M_MOUNT);
return (error);
}
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
mp->mnt_flag |= MNT_ROOTFS;
mp->mnt_vnodecovered = NULLVP;
imp = VFSTOISOFS(mp);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.3 (Berkeley) 1/31/94
* $Id: cd9660_vfsops.c,v 1.12 1995/05/19 03:25:35 davidg Exp $
* $Id: cd9660_vfsops.c,v 1.13 1995/05/30 08:05:03 rgrimes Exp $
*/
#include <sys/param.h>
@ -113,7 +113,7 @@ cd9660_mountroot()
free(mp, M_MOUNT);
return (error);
}
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
mp->mnt_flag |= MNT_ROOTFS;
mp->mnt_vnodecovered = NULLVP;
imp = VFSTOISOFS(mp);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
* $Id: init_main.c,v 1.24 1995/05/14 02:59:55 davidg Exp $
* $Id: init_main.c,v 1.25 1995/05/19 03:26:43 davidg Exp $
*/
#include <sys/param.h>
@ -288,7 +288,7 @@ main(framep)
panic("cannot mount root");
/* Get the vnode for '/'. Set fdp->fd_fd.fd_cdir to reference it. */
if (VFS_ROOT(mountlist.tqh_first, &rootvnode))
if (VFS_ROOT(mountlist.cqh_first, &rootvnode))
panic("cannot find root vnode");
fdp->fd_fd.fd_cdir = rootvnode;
VREF(fdp->fd_fd.fd_cdir);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
* $Id: vfs_subr.c,v 1.33 1995/07/08 04:10:32 davidg Exp $
* $Id: vfs_subr.c,v 1.34 1995/07/13 08:47:40 davidg Exp $
*/
/*
@ -100,7 +100,7 @@ vntblinit()
desiredvnodes = maxproc + vm_object_cache_max;
TAILQ_INIT(&vnode_free_list);
TAILQ_INIT(&mountlist);
CIRCLEQ_INIT(&mountlist);
}
/*
@ -214,12 +214,12 @@ vfs_unmountroot(rootfs)
void
vfs_unmountall()
{
struct mount *mp, *mp_next, *rootfs = NULL;
struct mount *mp, *nmp, *rootfs = NULL;
int error;
/* unmount all but rootfs */
for (mp = mountlist.tqh_first; mp != NULL; mp = mp_next) {
mp_next = mp->mnt_list.tqe_next;
for (mp = mountlist.cqh_last; mp != (void *)&mountlist; mp = nmp) {
nmp = mp->mnt_list.cqe_prev;
if (mp->mnt_flag & MNT_ROOTFS) {
rootfs = mp;
@ -252,7 +252,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);
@ -278,7 +279,7 @@ getnewfsid(mp, mtype)
++xxxfs_mntid;
tfsid.val[0] = makedev(nblkdev + mtype, 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++;
@ -1252,7 +1253,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)
@ -1290,8 +1292,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;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.29 1995/07/31 00:35:47 bde Exp $
* $Id: vfs_syscalls.c,v 1.30 1995/08/01 18:50:39 davidg Exp $
*/
#include <sys/param.h>
@ -190,10 +190,12 @@ update:
*/
cache_purge(vp);
if (!error) {
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
VOP_UNLOCK(vp);
vfs_unlock(mp);
error = VFS_START(mp, 0, p);
if (error)
vrele(vp);
} else {
mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0;
vfs_unlock(mp);
@ -294,7 +296,7 @@ dounmount(mp, flags, p)
vfs_unlock(mp);
} else {
vrele(coveredvp);
TAILQ_REMOVE(&mountlist, mp, mnt_list);
CIRCLEQ_REMOVE(&mountlist, mp, mnt_list);
mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0;
vfs_unlock(mp);
mp->mnt_vfc->vfc_refcount--;
@ -323,7 +325,7 @@ sync(p, uap, retval)
register struct mount *mp;
int asyncflag;
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 mount
* and unmount.
@ -456,8 +458,9 @@ getfsstat(p, uap, retval)
maxcount = uap->bufsize / sizeof(struct statfs);
sfsp = (caddr_t)uap->buf;
for (count = 0, mp = mountlist.tqh_first; mp != NULL; mp = nmp) {
nmp = mp->mnt_list.tqe_next;
count = 0;
for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) {
nmp = mp->mnt_list.cqe_next;
if (sfsp && count < maxcount &&
((mp->mnt_flag & MNT_MLOCK) == 0)) {
sp = &mp->mnt_stat;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
* $Id: vfs_subr.c,v 1.33 1995/07/08 04:10:32 davidg Exp $
* $Id: vfs_subr.c,v 1.34 1995/07/13 08:47:40 davidg Exp $
*/
/*
@ -100,7 +100,7 @@ vntblinit()
desiredvnodes = maxproc + vm_object_cache_max;
TAILQ_INIT(&vnode_free_list);
TAILQ_INIT(&mountlist);
CIRCLEQ_INIT(&mountlist);
}
/*
@ -214,12 +214,12 @@ vfs_unmountroot(rootfs)
void
vfs_unmountall()
{
struct mount *mp, *mp_next, *rootfs = NULL;
struct mount *mp, *nmp, *rootfs = NULL;
int error;
/* unmount all but rootfs */
for (mp = mountlist.tqh_first; mp != NULL; mp = mp_next) {
mp_next = mp->mnt_list.tqe_next;
for (mp = mountlist.cqh_last; mp != (void *)&mountlist; mp = nmp) {
nmp = mp->mnt_list.cqe_prev;
if (mp->mnt_flag & MNT_ROOTFS) {
rootfs = mp;
@ -252,7 +252,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);
@ -278,7 +279,7 @@ getnewfsid(mp, mtype)
++xxxfs_mntid;
tfsid.val[0] = makedev(nblkdev + mtype, 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++;
@ -1252,7 +1253,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)
@ -1290,8 +1292,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;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.29 1995/07/31 00:35:47 bde Exp $
* $Id: vfs_syscalls.c,v 1.30 1995/08/01 18:50:39 davidg Exp $
*/
#include <sys/param.h>
@ -190,10 +190,12 @@ update:
*/
cache_purge(vp);
if (!error) {
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
VOP_UNLOCK(vp);
vfs_unlock(mp);
error = VFS_START(mp, 0, p);
if (error)
vrele(vp);
} else {
mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0;
vfs_unlock(mp);
@ -294,7 +296,7 @@ dounmount(mp, flags, p)
vfs_unlock(mp);
} else {
vrele(coveredvp);
TAILQ_REMOVE(&mountlist, mp, mnt_list);
CIRCLEQ_REMOVE(&mountlist, mp, mnt_list);
mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0;
vfs_unlock(mp);
mp->mnt_vfc->vfc_refcount--;
@ -323,7 +325,7 @@ sync(p, uap, retval)
register struct mount *mp;
int asyncflag;
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 mount
* and unmount.
@ -456,8 +458,9 @@ getfsstat(p, uap, retval)
maxcount = uap->bufsize / sizeof(struct statfs);
sfsp = (caddr_t)uap->buf;
for (count = 0, mp = mountlist.tqh_first; mp != NULL; mp = nmp) {
nmp = mp->mnt_list.tqe_next;
count = 0;
for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) {
nmp = mp->mnt_list.cqe_next;
if (sfsp && count < maxcount &&
((mp->mnt_flag & MNT_MLOCK) == 0)) {
sp = &mp->mnt_stat;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_nqlease.c 8.3 (Berkeley) 1/4/94
* $Id: nfs_nqlease.c,v 1.11 1995/05/30 08:12:36 rgrimes Exp $
* $Id: nfs_nqlease.c,v 1.12 1995/06/27 11:06:36 dfr Exp $
*/
/*
@ -1172,12 +1172,8 @@ nqnfs_lease_updatetime(deltat)
* Search the mount list for all nqnfs mounts and do their timer
* queues.
*/
#if NetBSD >= 1994101
for (mp = mountlist.cqh_first; mp != (void *)&mountlist;
mp = mp->mnt_list.cqe_next) {
#else
for (mp = mountlist.tqh_first; mp != NULL; mp = mp->mnt_list.tqe_next) {
#endif
#ifdef __NetBSD__
if (!strcmp(&mp->mnt_stat.f_fstypename[0], MOUNT_NFS)) {
#else

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94
* $Id: nfs_vfsops.c,v 1.16 1995/06/27 11:06:51 dfr Exp $
* $Id: nfs_vfsops.c,v 1.17 1995/07/07 11:01:31 dfr Exp $
*/
#include <sys/param.h>
@ -417,11 +417,7 @@ nfs_mountroot()
if (vfs_lock(mp))
panic("nfs_mountroot: vfs_lock");
#if NetBSD >= 1994101
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
#else
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
#endif
mp->mnt_flag |= MNT_ROOTFS;
mp->mnt_vnodecovered = NULLVP;
vfs_unlock(mp);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94
* $Id: nfs_vfsops.c,v 1.16 1995/06/27 11:06:51 dfr Exp $
* $Id: nfs_vfsops.c,v 1.17 1995/07/07 11:01:31 dfr Exp $
*/
#include <sys/param.h>
@ -417,11 +417,7 @@ nfs_mountroot()
if (vfs_lock(mp))
panic("nfs_mountroot: vfs_lock");
#if NetBSD >= 1994101
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
#else
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
#endif
mp->mnt_flag |= MNT_ROOTFS;
mp->mnt_vnodecovered = NULLVP;
vfs_unlock(mp);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)mount.h 8.13 (Berkeley) 3/27/94
* $Id: mount.h,v 1.19 1995/05/30 08:14:28 rgrimes Exp $
* $Id: mount.h,v 1.20 1995/06/27 11:07:08 dfr Exp $
*/
#ifndef _SYS_MOUNT_H_
@ -129,15 +129,15 @@ struct statfs {
LIST_HEAD(vnodelst, vnode);
struct mount {
TAILQ_ENTRY(mount) mnt_list; /* mount list */
CIRCLEQ_ENTRY(mount) mnt_list; /* mount list */
struct vfsops *mnt_op; /* operations on fs */
struct vfsconf *mnt_vfc; /* configuration info */
struct vnode *mnt_vnodecovered; /* vnode we mounted on */
struct vnodelst mnt_vnodelist; /* list of vnodes this mount */
int mnt_flag; /* flags */
int mnt_maxsymlinklen; /* max size of short symlink */
struct statfs mnt_stat; /* cache of filesystem stats */
qaddr_t mnt_data; /* private data */
struct vfsconf *mnt_vfc; /* configuration info */
};
/*
@ -484,7 +484,7 @@ void vfs_unlock __P((struct mount *)); /* unlock a vfs */
void vfs_unmountall __P((void));
int vfs_busy __P((struct mount *)); /* mark a vfs busy */
void vfs_unbusy __P((struct mount *)); /* mark a vfs not busy */
extern TAILQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */
extern CIRCLEQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */
extern struct vfsops *vfssw[]; /* filesystem type table */
#else /* KERNEL */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
* $Id: ffs_vfsops.c,v 1.25 1995/07/21 16:20:20 davidg Exp $
* $Id: ffs_vfsops.c,v 1.26 1995/08/06 11:56:42 davidg Exp $
*/
#include <sys/param.h>
@ -125,7 +125,7 @@ ffs_mountroot()
free(mp, M_MOUNT);
return (error);
}
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
mp->mnt_flag |= MNT_ROOTFS;
mp->mnt_vnodecovered = NULLVP;
ump = VFSTOUFS(mp);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)lfs_bio.c 8.4 (Berkeley) 12/30/93
* $Id: lfs_bio.c,v 1.4 1994/08/20 03:49:01 davidg Exp $
* $Id: lfs_bio.c,v 1.5 1994/10/10 01:04:49 phk Exp $
*/
#include <sys/param.h>
@ -142,7 +142,7 @@ 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 (mp->mnt_stat.f_type == MOUNT_LFS &&
(mp->mnt_flag & (MNT_MLOCK|MNT_RDONLY|MNT_UNMOUNT)) == 0 &&

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)mfs_vfsops.c 8.4 (Berkeley) 4/16/94
* $Id: mfs_vfsops.c,v 1.8 1995/05/19 03:27:01 davidg Exp $
* $Id: mfs_vfsops.c,v 1.9 1995/05/29 03:27:37 phk Exp $
*/
#include <sys/param.h>
@ -129,7 +129,7 @@ mfs_mountroot()
free(mfsp, M_MFSNODE);
return (error);
}
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
mp->mnt_flag |= MNT_ROOTFS;
mp->mnt_vnodecovered = NULLVP;
ump = VFSTOUFS(mp);