From owner-svn-src-head@FreeBSD.ORG Tue Dec 30 21:42:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C63178D; Tue, 30 Dec 2014 21:42:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37B5C2C18; Tue, 30 Dec 2014 21:41:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBULfauA076792; Tue, 30 Dec 2014 21:41:36 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBULfaoZ076791; Tue, 30 Dec 2014 21:41:36 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201412302141.sBULfaoZ076791@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 30 Dec 2014 21:41:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276425 - head/sys/fs/nullfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Dec 2014 21:42:39 -0000 Author: mjg Date: Tue Dec 30 21:41:35 2014 New Revision: 276425 URL: https://svnweb.freebsd.org/changeset/base/276425 Log: Convert nullfs hash lock from a mutex to an rwlock. Modified: head/sys/fs/nullfs/null_subr.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Tue Dec 30 21:40:45 2014 (r276424) +++ head/sys/fs/nullfs/null_subr.c Tue Dec 30 21:41:35 2014 (r276425) @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -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