Replace lockmgr lock protecting smbfs node hash table with sx lock.

MFC after:	1 month
This commit is contained in:
Robert Watson 2008-03-02 18:56:13 +00:00
parent 208b3a93ac
commit 7947229ff6
3 changed files with 10 additions and 9 deletions

View File

@ -65,6 +65,8 @@ struct smbfs_args {
#ifdef _KERNEL
#include <sys/_sx.h>
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_SMBFSMNT);
#endif
@ -90,7 +92,7 @@ struct smbmount {
/* struct simplelock sm_npslock;*/
struct smbnode * sm_npstack[SMBFS_MAXPATHCOMP];
int sm_caseopt;
struct lock sm_hashlock;
struct sx sm_hashlock;
LIST_HEAD(smbnode_hashhead, smbnode) *sm_hash;
u_long sm_hashlen;
int sm_didrele;

View File

@ -40,6 +40,7 @@
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/vnode.h>
@ -58,11 +59,8 @@
#include <fs/smbfs/smbfs_subr.h>
#define SMBFS_NOHASH(smp, hval) (&(smp)->sm_hash[(hval) & (smp)->sm_hashlen])
#define smbfs_hash_lock(smp, td) \
lockmgr(&smp->sm_hashlock, LK_EXCLUSIVE, NULL)
#define smbfs_hash_unlock(smp, td) \
lockmgr(&smp->sm_hashlock, LK_RELEASE, NULL)
#define smbfs_hash_lock(smp, td) sx_xlock(&smp->sm_hashlock)
#define smbfs_hash_unlock(smp, td) sx_xunlock(&smp->sm_hashlock)
extern struct vop_vector smbfs_vnodeops; /* XXX -> .h file */

View File

@ -44,6 +44,7 @@
#include <sys/stat.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/sx.h>
#include <netsmb/smb.h>
@ -192,7 +193,7 @@ smbfs_mount(struct mount *mp, struct thread *td)
smp->sm_hash = hashinit(desiredvnodes, M_SMBFSHASH, &smp->sm_hashlen);
if (smp->sm_hash == NULL)
goto bad;
lockinit(&smp->sm_hashlock, PVFS, "smbfsh", 0, 0);
sx_init(&smp->sm_hashlock, "smbfsh");
smp->sm_share = ssp;
smp->sm_root = NULL;
if (1 != vfs_scanopt(mp->mnt_optnew,
@ -264,7 +265,7 @@ bad:
if (smp) {
if (smp->sm_hash)
free(smp->sm_hash, M_SMBFSHASH);
lockdestroy(&smp->sm_hashlock);
sx_destroy(&smp->sm_hashlock);
#ifdef SMBFS_USEZONE
zfree(smbfsmount_zone, smp);
#else
@ -312,7 +313,7 @@ smbfs_unmount(struct mount *mp, int mntflags, struct thread *td)
if (smp->sm_hash)
free(smp->sm_hash, M_SMBFSHASH);
lockdestroy(&smp->sm_hashlock);
sx_destroy(&smp->sm_hashlock);
#ifdef SMBFS_USEZONE
zfree(smbfsmount_zone, smp);
#else