diff options
author | Pedro Martelletto <pedro@cvs.openbsd.org> | 2006-04-19 11:55:56 +0000 |
---|---|---|
committer | Pedro Martelletto <pedro@cvs.openbsd.org> | 2006-04-19 11:55:56 +0000 |
commit | cc29e9cd03bbae7b4208a429f2b19cec76c97cda (patch) | |
tree | 7838b983f5eccae84ca029e608a7a433f9d22aa0 /sys/kern | |
parent | 9a844318226ccb44fc573779b6ee31f5af4e966e (diff) |
Remove unused mount list simple_lock() goo
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_subr.c | 21 | ||||
-rw-r--r-- | sys/kern/vfs_sync.c | 8 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 30 |
3 files changed, 23 insertions, 36 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 55aeb0c6a4e..ffb178d5a3a 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.122 2006/01/09 12:43:16 pedro Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.123 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -92,7 +92,6 @@ struct freelst vnode_hold_list; /* list of vnodes referencing buffers */ struct freelst vnode_free_list; /* vnode free list */ struct mntlist mountlist; /* mounted filesystem list */ -struct simplelock mountlist_slock; static struct simplelock mntid_slock; struct simplelock mntvnode_slock; struct simplelock vnode_free_list_slock; @@ -136,7 +135,6 @@ vntblinit(void) TAILQ_INIT(&vnode_free_list); simple_lock_init(&vnode_free_list_slock); CIRCLEQ_INIT(&mountlist); - simple_lock_init(&mountlist_slock); /* * Initialize the filesystem syncer. */ @@ -264,15 +262,13 @@ vfs_getvfs(fsid_t *fsid) { struct mount *mp; - simple_lock(&mountlist_slock); CIRCLEQ_FOREACH(mp, &mountlist, mnt_list) { if (mp->mnt_stat.f_fsid.val[0] == fsid->val[0] && mp->mnt_stat.f_fsid.val[1] == fsid->val[1]) { - simple_unlock(&mountlist_slock); return (mp); } } - simple_unlock(&mountlist_slock); + return ((struct mount *)0); } @@ -1334,10 +1330,10 @@ printlockedvnodes(void) struct vnode *vp; printf("Locked vnodes\n"); - simple_lock(&mountlist_slock); + for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -1345,11 +1341,9 @@ printlockedvnodes(void) if (VOP_ISLOCKED(vp)) vprint((char *)0, vp); } - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); } #endif @@ -1415,10 +1409,9 @@ sysctl_vnode(char *where, size_t *sizep, struct proc *p) } ewhere = where + *sizep; - simple_lock(&mountlist_slock); for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -1459,14 +1452,12 @@ again: } simple_unlock(&mntvnode_slock); - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); - *sizep = bp - where; + return (0); } diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c index 0d55326971f..89367839c17 100644 --- a/sys/kern/vfs_sync.c +++ b/sys/kern/vfs_sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_sync.c,v 1.37 2006/01/09 12:43:16 pedro Exp $ */ +/* $OpenBSD: vfs_sync.c,v 1.38 2006/04/19 11:55:55 pedro Exp $ */ /* * Portions of this code are: @@ -353,16 +353,14 @@ sync_fsync(void *v) * Walk the list of vnodes pushing all that are dirty and * not already on the sync list. */ - simple_lock(&mountlist_slock); - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock) == 0) { + if (vfs_busy(mp, LK_NOWAIT, NULL) == 0) { asyncflag = mp->mnt_flag & MNT_ASYNC; mp->mnt_flag &= ~MNT_ASYNC; VFS_SYNC(mp, MNT_LAZY, ap->a_cred, ap->a_p); if (asyncflag) mp->mnt_flag |= MNT_ASYNC; vfs_unbusy(mp); - } else - simple_unlock(&mountlist_slock); + } return (0); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 93c5171593a..ce7965e8ac0 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.132 2006/03/26 17:47:10 mickey Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.133 2006/04/19 11:55:55 pedro Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -297,9 +297,7 @@ update: cache_purge(vp); if (!error) { vfsp->vfc_refcount++; - simple_lock(&mountlist_slock); CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - simple_unlock(&mountlist_slock); checkdirs(vp); VOP_UNLOCK(vp, 0, p); if ((mp->mnt_flag & MNT_RDONLY) == 0) @@ -434,24 +432,28 @@ dounmount(struct mount *mp, int flags, struct proc *p, struct vnode *olddp) (error = VFS_SYNC(mp, MNT_WAIT, p->p_ucred, p)) == 0) || (flags & MNT_FORCE)) error = VFS_UNMOUNT(mp, flags, p); - simple_lock(&mountlist_slock); + if (error && error != EIO && !(flags & MNT_DOOMED)) { if ((mp->mnt_flag & MNT_RDONLY) == 0 && hadsyncer) (void) vfs_allocate_syncvnode(mp); - lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK, - &mountlist_slock); + lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK, NULL); return (error); } + CIRCLEQ_REMOVE(&mountlist, mp, mnt_list); if ((coveredvp = mp->mnt_vnodecovered) != NULLVP) { coveredvp->v_mountedhere = NULL; vrele(coveredvp); } + mp->mnt_vfc->vfc_refcount--; + if (!LIST_EMPTY(&mp->mnt_vnodelist)) panic("unmount: dangling vnode"); - lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK, &mountlist_slock); + + lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK, NULL); free(mp, M_MOUNT); + return (0); } @@ -470,10 +472,9 @@ sys_sync(struct proc *p, void *v, register_t *retval) struct mount *mp, *nmp; int asyncflag; - simple_lock(&mountlist_slock); for (mp = CIRCLEQ_LAST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_PREV(mp, mnt_list); continue; } @@ -485,11 +486,9 @@ sys_sync(struct proc *p, void *v, register_t *retval) if (asyncflag) mp->mnt_flag |= MNT_ASYNC; } - simple_lock(&mountlist_slock); nmp = CIRCLEQ_PREV(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); #ifdef DEBUG if (syncprt) @@ -627,10 +626,10 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval) maxcount = SCARG(uap, bufsize) / sizeof(struct statfs); sfsp = SCARG(uap, buf); count = 0; - simple_lock(&mountlist_slock); + for (mp = CIRCLEQ_FIRST(&mountlist); mp != CIRCLEQ_END(&mountlist); mp = nmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock)) { + if (vfs_busy(mp, LK_NOWAIT, NULL)) { nmp = CIRCLEQ_NEXT(mp, mnt_list); continue; } @@ -643,7 +642,6 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval) (flags == MNT_WAIT || flags == 0) && (error = VFS_STATFS(mp, sp, p))) { - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); continue; @@ -667,15 +665,15 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval) sfsp++; } count++; - simple_lock(&mountlist_slock); nmp = CIRCLEQ_NEXT(mp, mnt_list); vfs_unbusy(mp); } - simple_unlock(&mountlist_slock); + if (sfsp && count > maxcount) *retval = maxcount; else *retval = count; + return (0); } |