summaryrefslogtreecommitdiffstats
path: root/sys/ntfs
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2000-10-04 01:29:17 +0000
committerjasone <jasone@FreeBSD.org>2000-10-04 01:29:17 +0000
commit4e290e67b7310d906f113850fddfdf1017a9d15b (patch)
treebae3e99c848c6e38aee34a7cf61ffa9ca55b0095 /sys/ntfs
parentbea51a4aa1bf67a183bd1d4a6227fa891345af60 (diff)
downloadFreeBSD-src-4e290e67b7310d906f113850fddfdf1017a9d15b.zip
FreeBSD-src-4e290e67b7310d906f113850fddfdf1017a9d15b.tar.gz
Convert lockmgr locks from using simple locks to using mutexes.
Add lockdestroy() and appropriate invocations, which corresponds to lockinit() and must be called to clean up after a lockmgr lock is no longer needed.
Diffstat (limited to 'sys/ntfs')
-rw-r--r--sys/ntfs/ntfs_ihash.c9
-rw-r--r--sys/ntfs/ntfs_ihash.h1
-rw-r--r--sys/ntfs/ntfs_inode.h2
-rw-r--r--sys/ntfs/ntfs_subr.c28
-rw-r--r--sys/ntfs/ntfs_subr.h1
-rw-r--r--sys/ntfs/ntfs_vfsops.c15
6 files changed, 45 insertions, 11 deletions
diff --git a/sys/ntfs/ntfs_ihash.c b/sys/ntfs/ntfs_ihash.c
index 0deecff..cd2300d 100644
--- a/sys/ntfs/ntfs_ihash.c
+++ b/sys/ntfs/ntfs_ihash.c
@@ -75,6 +75,15 @@ ntfs_nthashinit()
}
/*
+ * Destroy inode hash table.
+ */
+void
+ntfs_nthashdestroy(void)
+{
+ lockdestroy(&ntfs_hashlock);
+}
+
+/*
* Use the device/inum pair to find the incore inode, and return a pointer
* to it. If it is in core, return it, even if it is locked.
*/
diff --git a/sys/ntfs/ntfs_ihash.h b/sys/ntfs/ntfs_ihash.h
index 7b7143f..a3f166f 100644
--- a/sys/ntfs/ntfs_ihash.h
+++ b/sys/ntfs/ntfs_ihash.h
@@ -30,6 +30,7 @@
extern struct lock ntfs_hashlock;
void ntfs_nthashinit __P((void));
+void ntfs_nthashdestroy __P((void));
struct ntnode *ntfs_nthashlookup __P((dev_t, ino_t));
struct ntnode *ntfs_nthashget __P((dev_t, ino_t));
void ntfs_nthashins __P((struct ntnode *));
diff --git a/sys/ntfs/ntfs_inode.h b/sys/ntfs/ntfs_inode.h
index a86d5f7..a865276 100644
--- a/sys/ntfs/ntfs_inode.h
+++ b/sys/ntfs/ntfs_inode.h
@@ -69,7 +69,7 @@ struct ntnode {
/* locking */
struct lock i_lock;
- struct simplelock i_interlock;
+ struct mtx i_interlock;
int i_usecount;
LIST_HEAD(,fnode) i_fnlist;
diff --git a/sys/ntfs/ntfs_subr.c b/sys/ntfs/ntfs_subr.c
index e8f5588..f060e5b 100644
--- a/sys/ntfs/ntfs_subr.c
+++ b/sys/ntfs/ntfs_subr.c
@@ -361,7 +361,7 @@ ntfs_ntget(ip)
dprintf(("ntfs_ntget: get ntnode %d: %p, usecount: %d\n",
ip->i_number, ip, ip->i_usecount));
- simple_lock(&ip->i_interlock);
+ mtx_enter(&ip->i_interlock, MTX_DEF);
ip->i_usecount++;
LOCKMGR(&ip->i_lock, LK_EXCLUSIVE | LK_INTERLOCK, &ip->i_interlock);
@@ -410,7 +410,7 @@ ntfs_ntlookup(
/* init lock and lock the newborn ntnode */
lockinit(&ip->i_lock, PINOD, "ntnode", 0, LK_EXCLUSIVE);
- simple_lock_init(&ip->i_interlock);
+ mtx_init(&ip->i_interlock, "ntnode interlock", MTX_DEF);
ntfs_ntget(ip);
ntfs_nthashins(ip);
@@ -440,7 +440,7 @@ ntfs_ntput(ip)
dprintf(("ntfs_ntput: rele ntnode %d: %p, usecount: %d\n",
ip->i_number, ip, ip->i_usecount));
- simple_lock(&ip->i_interlock);
+ mtx_enter(&ip->i_interlock, MTX_DEF);
ip->i_usecount--;
#ifdef DIAGNOSTIC
@@ -464,6 +464,10 @@ ntfs_ntput(ip)
LIST_REMOVE(vap,va_list);
ntfs_freentvattr(vap);
}
+ mtx_exit(&ip->i_interlock, MTX_DEF);
+ mtx_destroy(&ip->i_interlock);
+ lockdestroy(&ip->i_lock);
+
FREE(ip, M_NTFSNTNODE);
} else {
LOCKMGR(&ip->i_lock, LK_RELEASE|LK_INTERLOCK, &ip->i_interlock);
@@ -477,9 +481,9 @@ void
ntfs_ntref(ip)
struct ntnode *ip;
{
- simple_lock(&ip->i_interlock);
+ mtx_enter(&ip->i_interlock, MTX_DEF);
ip->i_usecount++;
- simple_unlock(&ip->i_interlock);
+ mtx_exit(&ip->i_interlock, MTX_DEF);
dprintf(("ntfs_ntref: ino %d, usecount: %d\n",
ip->i_number, ip->i_usecount));
@@ -496,13 +500,13 @@ ntfs_ntrele(ip)
dprintf(("ntfs_ntrele: rele ntnode %d: %p, usecount: %d\n",
ip->i_number, ip, ip->i_usecount));
- simple_lock(&ip->i_interlock);
+ mtx_enter(&ip->i_interlock, MTX_DEF);
ip->i_usecount--;
if (ip->i_usecount < 0)
panic("ntfs_ntrele: ino: %d usecount: %d \n",
ip->i_number,ip->i_usecount);
- simple_unlock(&ip->i_interlock);
+ mtx_exit(&ip->i_interlock, MTX_DEF);
}
/*
@@ -771,6 +775,9 @@ ntfs_frele(
FREE(fp->f_attrname, M_TEMP);
if (fp->f_dirblbuf)
FREE(fp->f_dirblbuf, M_NTFSDIR);
+#ifdef __FreeBSD__
+ lockdestroy(&fp->f_lock);
+#endif
FREE(fp, M_NTFSFNODE);
ntfs_ntrele(ip);
}
@@ -1915,6 +1922,13 @@ ntfs_toupper_init()
ntfs_toupper_usecount = 0;
}
+void
+ntfs_toupper_destroy(void)
+{
+
+ lockdestroy(&ntfs_toupper_lock);
+}
+
/*
* if the ntfs_toupper_tab[] is filled already, just raise use count;
* otherwise read the data from the filesystem we are currently mounting
diff --git a/sys/ntfs/ntfs_subr.h b/sys/ntfs/ntfs_subr.h
index a0cda50..8f1480a 100644
--- a/sys/ntfs/ntfs_subr.h
+++ b/sys/ntfs/ntfs_subr.h
@@ -103,6 +103,7 @@ int ntfs_loadntnode __P(( struct ntfsmount *, struct ntnode * ));
int ntfs_writentvattr_plain __P((struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *, size_t *, struct uio *));
int ntfs_writeattr_plain __P((struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, size_t *, struct uio *));
void ntfs_toupper_init __P((void));
+void ntfs_toupper_destroy __P((void));
int ntfs_toupper_use __P((struct mount *, struct ntfsmount *));
void ntfs_toupper_unuse __P((void));
int ntfs_fget __P((struct ntfsmount *, struct ntnode *, int, char *, struct fnode **));
diff --git a/sys/ntfs/ntfs_vfsops.c b/sys/ntfs/ntfs_vfsops.c
index 77ac0d8..1b0b97a 100644
--- a/sys/ntfs/ntfs_vfsops.c
+++ b/sys/ntfs/ntfs_vfsops.c
@@ -196,9 +196,9 @@ ntfs_mountroot()
return (error);
}
- simple_lock(&mountlist_slock);
+ mtx_enter(&mountlist_mtx, MTX_DEF);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
- simple_unlock(&mountlist_slock);
+ mtx_exit(&mountlist_mtx, MTX_DEF);
(void)ntfs_statfs(mp, &mp->mnt_stat, p);
vfs_unbusy(mp);
return (0);
@@ -222,6 +222,15 @@ ntfs_init (
return 0;
}
+static int
+ntfs_uninit (
+ struct vfsconf *vcp )
+{
+ ntfs_toupper_destroy();
+ ntfs_nthashdestroy();
+ return 0;
+}
+
#endif /* NetBSD */
static int
@@ -1006,7 +1015,7 @@ static struct vfsops ntfs_vfsops = {
ntfs_checkexp,
ntfs_vptofh,
ntfs_init,
- vfs_stduninit,
+ ntfs_uninit,
vfs_stdextattrctl,
};
VFS_SET(ntfs_vfsops, ntfs, 0);
OpenPOWER on IntegriCloud