diff options
author | jasone <jasone@FreeBSD.org> | 2001-01-24 12:35:55 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 2001-01-24 12:35:55 +0000 |
commit | 8d2ec1ebc4a9454e2936c6fcbe29a5f1fd83504f (patch) | |
tree | 23bd3f0014237e1b861fed6a7c3b587948d149d5 /sys/fs | |
parent | c5cc2f8e2621f1d090434a5474a18fae384e1db6 (diff) | |
download | FreeBSD-src-8d2ec1ebc4a9454e2936c6fcbe29a5f1fd83504f.zip FreeBSD-src-8d2ec1ebc4a9454e2936c6fcbe29a5f1fd83504f.tar.gz |
Convert all simplelocks to mutexes and remove the simplelock implementations.
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/cd9660/cd9660_node.c | 25 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs.h | 4 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_hash.c | 28 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_vfsops.c | 3 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_vnops.c | 3 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_denode.c | 26 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vfsops.c | 13 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_ihash.c | 20 |
8 files changed, 58 insertions, 64 deletions
diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c index 5074679..f260802 100644 --- a/sys/fs/cd9660/cd9660_node.c +++ b/sys/fs/cd9660/cd9660_node.c @@ -47,8 +47,7 @@ #include <sys/vnode.h> #include <sys/malloc.h> #include <sys/stat.h> - -#include <machine/mutex.h> +#include <sys/mutex.h> #include <isofs/cd9660/iso.h> #include <isofs/cd9660/cd9660_node.h> @@ -60,9 +59,7 @@ static struct iso_node **isohashtbl; static u_long isohash; #define INOHASH(device, inum) ((minor(device) + ((inum)>>12)) & isohash) -#ifndef NULL_SIMPLELOCKS -static struct simplelock cd9660_ihash_slock; -#endif +static struct mtx cd9660_ihash_mtx; static void cd9660_ihashrem __P((struct iso_node *)); static unsigned cd9660_chars2ui __P((unsigned char *begin, int len)); @@ -76,7 +73,7 @@ cd9660_init(vfsp) { isohashtbl = hashinit(desiredvnodes, M_ISOFSMNT, &isohash); - simple_lock_init(&cd9660_ihash_slock); + mtx_init(&cd9660_ihash_mtx, "cd9660_ihash", MTX_DEF); return (0); } @@ -105,18 +102,18 @@ cd9660_ihashget(dev, inum) struct vnode *vp; loop: - simple_lock(&cd9660_ihash_slock); + mtx_enter(&cd9660_ihash_mtx, MTX_DEF); for (ip = isohashtbl[INOHASH(dev, inum)]; ip; ip = ip->i_next) { if (inum == ip->i_number && dev == ip->i_dev) { vp = ITOV(ip); mtx_enter(&vp->v_interlock, MTX_DEF); - simple_unlock(&cd9660_ihash_slock); + mtx_exit(&cd9660_ihash_mtx, MTX_DEF); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; return (vp); } } - simple_unlock(&cd9660_ihash_slock); + mtx_exit(&cd9660_ihash_mtx, MTX_DEF); return (NULL); } @@ -130,14 +127,14 @@ cd9660_ihashins(ip) struct proc *p = curproc; /* XXX */ struct iso_node **ipp, *iq; - simple_lock(&cd9660_ihash_slock); + mtx_enter(&cd9660_ihash_mtx, MTX_DEF); ipp = &isohashtbl[INOHASH(ip->i_dev, ip->i_number)]; if ((iq = *ipp) != NULL) iq->i_prev = &ip->i_next; ip->i_next = iq; ip->i_prev = ipp; *ipp = ip; - simple_unlock(&cd9660_ihash_slock); + mtx_exit(&cd9660_ihash_mtx, MTX_DEF); lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct mtx *)0, p); } @@ -151,7 +148,7 @@ cd9660_ihashrem(ip) { register struct iso_node *iq; - simple_lock(&cd9660_ihash_slock); + mtx_enter(&cd9660_ihash_mtx, MTX_DEF); if ((iq = ip->i_next) != NULL) iq->i_prev = ip->i_prev; *ip->i_prev = iq; @@ -159,7 +156,7 @@ cd9660_ihashrem(ip) ip->i_next = NULL; ip->i_prev = NULL; #endif - simple_unlock(&cd9660_ihash_slock); + mtx_exit(&cd9660_ihash_mtx, MTX_DEF); } /* @@ -188,7 +185,7 @@ cd9660_inactive(ap) * so that it can be reused immediately. */ if (ip->inode.iso_mode == 0) - vrecycle(vp, (struct simplelock *)0, p); + vrecycle(vp, NULL, p); return error; } diff --git a/sys/fs/hpfs/hpfs.h b/sys/fs/hpfs/hpfs.h index be12791..0f07880 100644 --- a/sys/fs/hpfs/hpfs.h +++ b/sys/fs/hpfs/hpfs.h @@ -335,9 +335,7 @@ struct hpfsmount { #define H_INVAL 0x0010 /* Invalid node */ struct hpfsnode { struct lock h_lock; /* Must be first, for std vops */ -#ifndef NULL_SIMPLELOCKS - struct simplelock h_interlock; -#endif + struct mtx h_interlock; LIST_ENTRY(hpfsnode) h_hash; diff --git a/sys/fs/hpfs/hpfs_hash.c b/sys/fs/hpfs/hpfs_hash.c index 440d573..0fe3f4f 100644 --- a/sys/fs/hpfs/hpfs_hash.c +++ b/sys/fs/hpfs/hpfs_hash.c @@ -42,6 +42,7 @@ #include <sys/mount.h> #include <sys/malloc.h> #include <sys/proc.h> +#include <sys/mutex.h> #include <fs/hpfs/hpfs.h> @@ -53,9 +54,7 @@ MALLOC_DEFINE(M_HPFSHASH, "HPFS hash", "HPFS node hash tables"); static LIST_HEAD(hphashhead, hpfsnode) *hpfs_hphashtbl; static u_long hpfs_hphash; /* size of hash table - 1 */ #define HPNOHASH(dev, lsn) (&hpfs_hphashtbl[(minor(dev) + (lsn)) & hpfs_hphash]) -#ifndef NULL_SIMPLELOCKS -static struct simplelock hpfs_hphash_slock; -#endif +static struct mtx hpfs_hphash_mtx; struct lock hpfs_hphash_lock; /* @@ -68,7 +67,7 @@ hpfs_hphashinit() lockinit (&hpfs_hphash_lock, PINOD, "hpfs_hphashlock", 0, 0); hpfs_hphashtbl = HASHINIT(desiredvnodes, M_HPFSHASH, M_WAITOK, &hpfs_hphash); - simple_lock_init(&hpfs_hphash_slock); + mtx_init(&hpfs_hphash_mtx, "hpfs hphash", MTX_DEF); } /* @@ -79,6 +78,7 @@ hpfs_hphashdestroy(void) { lockdestroy(&hpfs_hphash_lock); + mtx_destroy(&hpfs_hphash_mtx); } /* @@ -92,11 +92,11 @@ hpfs_hphashlookup(dev, ino) { struct hpfsnode *hp; - simple_lock(&hpfs_hphash_slock); + mtx_enter(&hpfs_hphash_mtx, MTX_DEF); LIST_FOREACH(hp, HPNOHASH(dev, ino), h_hash) if (ino == hp->h_no && dev == hp->h_dev) break; - simple_unlock(&hpfs_hphash_slock); + mtx_exit(&hpfs_hphash_mtx, MTX_DEF); return (hp); } @@ -110,14 +110,14 @@ hpfs_hphashget(dev, ino) struct hpfsnode *hp; loop: - simple_lock(&hpfs_hphash_slock); + mtx_enter(&hpfs_hphash_mtx, MTX_DEF); LIST_FOREACH(hp, HPNOHASH(dev, ino), h_hash) { if (ino == hp->h_no && dev == hp->h_dev) { LOCKMGR(&hp->h_intlock, LK_EXCLUSIVE | LK_INTERLOCK, &hpfs_hphash_slock, NULL); return (hp); } } - simple_unlock(&hpfs_hphash_slock); + mtx_exit(&hpfs_hphash_mtx, MTX_DEF); return (hp); } #endif @@ -132,7 +132,7 @@ hpfs_hphashvget(dev, ino, p) struct vnode *vp; loop: - simple_lock(&hpfs_hphash_slock); + mtx_enter(&hpfs_hphash_mtx, MTX_DEF); LIST_FOREACH(hp, HPNOHASH(dev, ino), h_hash) { if (ino == hp->h_no && dev == hp->h_dev) { vp = HPTOV(hp); @@ -143,7 +143,7 @@ loop: return (vp); } } - simple_unlock(&hpfs_hphash_slock); + mtx_exit(&hpfs_hphash_mtx, MTX_DEF); return (NULLVP); } @@ -156,11 +156,11 @@ hpfs_hphashins(hp) { struct hphashhead *hpp; - simple_lock(&hpfs_hphash_slock); + mtx_enter(&hpfs_hphash_mtx, MTX_DEF); hpp = HPNOHASH(hp->h_dev, hp->h_no); hp->h_flag |= H_HASHED; LIST_INSERT_HEAD(hpp, hp, h_hash); - simple_unlock(&hpfs_hphash_slock); + mtx_exit(&hpfs_hphash_mtx, MTX_DEF); } /* @@ -170,7 +170,7 @@ void hpfs_hphashrem(hp) struct hpfsnode *hp; { - simple_lock(&hpfs_hphash_slock); + mtx_enter(&hpfs_hphash_mtx, MTX_DEF); if (hp->h_flag & H_HASHED) { hp->h_flag &= ~H_HASHED; LIST_REMOVE(hp, h_hash); @@ -179,5 +179,5 @@ hpfs_hphashrem(hp) hp->h_hash.le_prev = NULL; #endif } - simple_unlock(&hpfs_hphash_slock); + mtx_exit(&hpfs_hphash_mtx, MTX_DEF); } diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index ab6d763..5b8d9bb 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -686,7 +686,8 @@ hpfs_vget( if (ino == (ino_t)hpmp->hpm_su.su_rootfno) vp->v_flag |= VROOT; - simple_lock_init(&hp->h_interlock); + + mtx_init(&hp->h_interlock, "hpfsnode interlock", MTX_DEF); lockinit(&hp->h_lock, PINOD, "hpnode", 0, 0); hp->h_flag = H_INVAL; diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c index 35bf1fb..a52020f 100644 --- a/sys/fs/hpfs/hpfs_vnops.c +++ b/sys/fs/hpfs/hpfs_vnops.c @@ -665,7 +665,7 @@ hpfs_inactive(ap) if (hp->h_flag & H_INVAL) { VOP__UNLOCK(vp,0,ap->a_p); #if defined(__FreeBSD__) - vrecycle(vp, (struct simplelock *)0, ap->a_p); + vrecycle(vp, NULL, ap->a_p); #else /* defined(__NetBSD__) */ vgone(vp); #endif @@ -700,6 +700,7 @@ hpfs_reclaim(ap) } lockdestroy(&hp->h_lock); + mtx_destroy(&hp->h_interlock); vp->v_data = NULL; diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 6aea47a..6c1a3c7 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -56,12 +56,11 @@ #include <sys/bio.h> #include <sys/buf.h> #include <sys/vnode.h> +#include <sys/mutex.h> #include <vm/vm.h> #include <vm/vm_extern.h> -#include <machine/mutex.h> - #include <msdosfs/bpb.h> #include <msdosfs/msdosfsmount.h> #include <msdosfs/direntry.h> @@ -74,9 +73,7 @@ static struct denode **dehashtbl; static u_long dehash; /* size of hash table - 1 */ #define DEHASH(dev, dcl, doff) (dehashtbl[(minor(dev) + (dcl) + (doff) / \ sizeof(struct direntry)) & dehash]) -#ifndef NULL_SIMPLELOCKS -static struct simplelock dehash_slock; -#endif +static struct mtx dehash_mtx; union _qcvt { quad_t qcvt; @@ -107,7 +104,7 @@ msdosfs_init(vfsp) struct vfsconf *vfsp; { dehashtbl = hashinit(desiredvnodes/2, M_MSDOSFSMNT, &dehash); - simple_lock_init(&dehash_slock); + mtx_init(&dehash_mtx, "msdosfs dehash", MTX_DEF); return (0); } @@ -118,6 +115,7 @@ msdosfs_uninit(vfsp) if (dehashtbl) free(dehashtbl, M_MSDOSFSMNT); + mtx_destroy(&dehash_mtx); return (0); } @@ -132,7 +130,7 @@ msdosfs_hashget(dev, dirclust, diroff) struct vnode *vp; loop: - simple_lock(&dehash_slock); + mtx_enter(&dehash_mtx, MTX_DEF); for (dep = DEHASH(dev, dirclust, diroff); dep; dep = dep->de_next) { if (dirclust == dep->de_dirclust && diroff == dep->de_diroffset @@ -140,13 +138,13 @@ loop: && dep->de_refcnt != 0) { vp = DETOV(dep); mtx_enter(&vp->v_interlock, MTX_DEF); - simple_unlock(&dehash_slock); + mtx_exit(&dehash_mtx, MTX_DEF); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; return (dep); } } - simple_unlock(&dehash_slock); + mtx_exit(&dehash_mtx, MTX_DEF); return (NULL); } @@ -156,7 +154,7 @@ msdosfs_hashins(dep) { struct denode **depp, *deq; - simple_lock(&dehash_slock); + mtx_enter(&dehash_mtx, MTX_DEF); depp = &DEHASH(dep->de_dev, dep->de_dirclust, dep->de_diroffset); deq = *depp; if (deq) @@ -164,7 +162,7 @@ msdosfs_hashins(dep) dep->de_next = deq; dep->de_prev = depp; *depp = dep; - simple_unlock(&dehash_slock); + mtx_exit(&dehash_mtx, MTX_DEF); } static void @@ -173,7 +171,7 @@ msdosfs_hashrem(dep) { struct denode *deq; - simple_lock(&dehash_slock); + mtx_enter(&dehash_mtx, MTX_DEF); deq = dep->de_next; if (deq) deq->de_prev = dep->de_prev; @@ -182,7 +180,7 @@ msdosfs_hashrem(dep) dep->de_next = NULL; dep->de_prev = NULL; #endif - simple_unlock(&dehash_slock); + mtx_exit(&dehash_mtx, MTX_DEF); } /* @@ -721,6 +719,6 @@ out: dep->de_Name[0]); #endif if (dep->de_Name[0] == SLOT_DELETED) - vrecycle(vp, (struct simplelock *)0, p); + vrecycle(vp, NULL, p); return (error); } diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index d116328..652e92b 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -61,8 +61,7 @@ #include <sys/fcntl.h> #include <sys/malloc.h> #include <sys/stat.h> /* defines ALLPERMS */ - -#include <machine/mutex.h> +#include <sys/mutex.h> #include <msdosfs/bpb.h> #include <msdosfs/bootsect.h> @@ -863,7 +862,7 @@ msdosfs_sync(mp, waitfor, cred, p) /* * Write back each (modified) denode. */ - simple_lock(&mntvnode_slock); + mtx_enter(&mntvnode_mtx, MTX_DEF); loop: for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nvp) { /* @@ -883,10 +882,10 @@ loop: mtx_exit(&vp->v_interlock, MTX_DEF); continue; } - simple_unlock(&mntvnode_slock); + mtx_exit(&mntvnode_mtx, MTX_DEF); error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p); if (error) { - simple_lock(&mntvnode_slock); + mtx_enter(&mntvnode_mtx, MTX_DEF); if (error == ENOENT) goto loop; continue; @@ -896,9 +895,9 @@ loop: allerror = error; VOP_UNLOCK(vp, 0, p); vrele(vp); - simple_lock(&mntvnode_slock); + mtx_enter(&mntvnode_mtx, MTX_DEF); } - simple_unlock(&mntvnode_slock); + mtx_exit(&mntvnode_mtx, MTX_DEF); /* * Flush filesystem control info. diff --git a/sys/fs/ntfs/ntfs_ihash.c b/sys/fs/ntfs/ntfs_ihash.c index 91f970f..d68c508 100644 --- a/sys/fs/ntfs/ntfs_ihash.c +++ b/sys/fs/ntfs/ntfs_ihash.c @@ -43,6 +43,7 @@ #include <sys/vnode.h> #include <sys/malloc.h> #include <sys/mount.h> +#include <sys/mutex.h> #include <ntfs/ntfs.h> #include <ntfs/ntfs_inode.h> @@ -56,9 +57,7 @@ MALLOC_DEFINE(M_NTFSNTHASH, "NTFS nthash", "NTFS ntnode hash tables"); static LIST_HEAD(nthashhead, ntnode) *ntfs_nthashtbl; static u_long ntfs_nthash; /* size of hash table - 1 */ #define NTNOHASH(device, inum) (&ntfs_nthashtbl[(minor(device) + (inum)) & ntfs_nthash]) -#ifndef NULL_SIMPLELOCKS -static struct simplelock ntfs_nthash_slock; -#endif +static struct mtx ntfs_nthash_mtx; struct lock ntfs_hashlock; /* @@ -70,7 +69,7 @@ ntfs_nthashinit() lockinit(&ntfs_hashlock, PINOD, "ntfs_nthashlock", 0, 0); ntfs_nthashtbl = HASHINIT(desiredvnodes, M_NTFSNTHASH, M_WAITOK, &ntfs_nthash); - simple_lock_init(&ntfs_nthash_slock); + mtx_init(&ntfs_nthash_mtx, "ntfs nthash", MTX_DEF); } /* @@ -80,6 +79,7 @@ void ntfs_nthashdestroy(void) { lockdestroy(&ntfs_hashlock); + mtx_destroy(&ntfs_nthash_mtx); } /* @@ -93,11 +93,11 @@ ntfs_nthashlookup(dev, inum) { struct ntnode *ip; - simple_lock(&ntfs_nthash_slock); + mtx_enter(&ntfs_nthash_mtx, MTX_DEF); for (ip = NTNOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) if (inum == ip->i_number && dev == ip->i_dev) break; - simple_unlock(&ntfs_nthash_slock); + mtx_exit(&ntfs_nthash_mtx, MTX_DEF); return (ip); } @@ -111,11 +111,11 @@ ntfs_nthashins(ip) { struct nthashhead *ipp; - simple_lock(&ntfs_nthash_slock); + mtx_enter(&ntfs_nthash_mtx, MTX_DEF); ipp = NTNOHASH(ip->i_dev, ip->i_number); LIST_INSERT_HEAD(ipp, ip, i_hash); ip->i_flag |= IN_HASHED; - simple_unlock(&ntfs_nthash_slock); + mtx_exit(&ntfs_nthash_mtx, MTX_DEF); } /* @@ -125,7 +125,7 @@ void ntfs_nthashrem(ip) struct ntnode *ip; { - simple_lock(&ntfs_nthash_slock); + mtx_enter(&ntfs_nthash_mtx, MTX_DEF); if (ip->i_flag & IN_HASHED) { ip->i_flag &= ~IN_HASHED; LIST_REMOVE(ip, i_hash); @@ -134,5 +134,5 @@ ntfs_nthashrem(ip) ip->i_hash.le_prev = NULL; #endif } - simple_unlock(&ntfs_nthash_slock); + mtx_exit(&ntfs_nthash_mtx, MTX_DEF); } |