summaryrefslogtreecommitdiffstats
path: root/sys/fs/nullfs
diff options
context:
space:
mode:
authormjg <mjg@FreeBSD.org>2014-12-30 21:41:35 +0000
committermjg <mjg@FreeBSD.org>2014-12-30 21:41:35 +0000
commitd80e0e454f31c667158dcc983e87bea0c3dc2068 (patch)
tree4249b7919f297518a821d67f95846cc38d9ad24c /sys/fs/nullfs
parent09f7a46ec71137e29d82d2f0811a7f81b6142266 (diff)
downloadFreeBSD-src-d80e0e454f31c667158dcc983e87bea0c3dc2068.zip
FreeBSD-src-d80e0e454f31c667158dcc983e87bea0c3dc2068.tar.gz
Convert nullfs hash lock from a mutex to an rwlock.
Diffstat (limited to 'sys/fs/nullfs')
-rw-r--r--sys/fs/nullfs/null_subr.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c
index fa6c4af..4d29add 100644
--- a/sys/fs/nullfs/null_subr.c
+++ b/sys/fs/nullfs/null_subr.c
@@ -38,7 +38,7 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/lock.h>
-#include <sys/mutex.h>
+#include <sys/rwlock.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/proc.h>
@@ -57,7 +57,7 @@
#define NULL_NHASH(vp) (&null_node_hashtbl[vfs_hash_index(vp) & null_hash_mask])
static LIST_HEAD(null_node_hashhead, null_node) *null_node_hashtbl;
-static struct mtx null_hashmtx;
+static struct rwlock null_hash_lock;
static u_long null_hash_mask;
static MALLOC_DEFINE(M_NULLFSHASH, "nullfs_hash", "NULLFS hash table");
@@ -75,7 +75,7 @@ nullfs_init(vfsp)
null_node_hashtbl = hashinit(desiredvnodes, M_NULLFSHASH,
&null_hash_mask);
- mtx_init(&null_hashmtx, "nullhs", NULL, MTX_DEF);
+ rw_init(&null_hash_lock, "nullhs");
return (0);
}
@@ -84,7 +84,7 @@ nullfs_uninit(vfsp)
struct vfsconf *vfsp;
{
- mtx_destroy(&null_hashmtx);
+ rw_destroy(&null_hash_lock);
hashdestroy(null_node_hashtbl, M_NULLFSHASH, null_hash_mask);
return (0);
}
@@ -111,7 +111,7 @@ null_hashget(mp, lowervp)
* reference count (but NOT the lower vnode's VREF counter).
*/
hd = NULL_NHASH(lowervp);
- mtx_lock(&null_hashmtx);
+ rw_rlock(&null_hash_lock);
LIST_FOREACH(a, hd, null_hash) {
if (a->null_lowervp == lowervp && NULLTOV(a)->v_mount == mp) {
/*
@@ -122,11 +122,11 @@ null_hashget(mp, lowervp)
*/
vp = NULLTOV(a);
vref(vp);
- mtx_unlock(&null_hashmtx);
+ rw_runlock(&null_hash_lock);
return (vp);
}
}
- mtx_unlock(&null_hashmtx);
+ rw_runlock(&null_hash_lock);
return (NULLVP);
}
@@ -144,7 +144,7 @@ null_hashins(mp, xp)
struct vnode *ovp;
hd = NULL_NHASH(xp->null_lowervp);
- mtx_lock(&null_hashmtx);
+ rw_wlock(&null_hash_lock);
LIST_FOREACH(oxp, hd, null_hash) {
if (oxp->null_lowervp == xp->null_lowervp &&
NULLTOV(oxp)->v_mount == mp) {
@@ -154,12 +154,12 @@ null_hashins(mp, xp)
*/
ovp = NULLTOV(oxp);
vref(ovp);
- mtx_unlock(&null_hashmtx);
+ rw_wunlock(&null_hash_lock);
return (ovp);
}
}
LIST_INSERT_HEAD(hd, xp, null_hash);
- mtx_unlock(&null_hashmtx);
+ rw_wunlock(&null_hash_lock);
return (NULLVP);
}
@@ -277,9 +277,9 @@ null_hashrem(xp)
struct null_node *xp;
{
- mtx_lock(&null_hashmtx);
+ rw_wlock(&null_hash_lock);
LIST_REMOVE(xp, null_hash);
- mtx_unlock(&null_hashmtx);
+ rw_wunlock(&null_hash_lock);
}
#ifdef DIAGNOSTIC
OpenPOWER on IntegriCloud