summaryrefslogtreecommitdiffstats
path: root/sys/gnu/ext2fs/ext2_ihash.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/gnu/ext2fs/ext2_ihash.c')
-rw-r--r--sys/gnu/ext2fs/ext2_ihash.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/gnu/ext2fs/ext2_ihash.c b/sys/gnu/ext2fs/ext2_ihash.c
index d11d4dc..d404e15 100644
--- a/sys/gnu/ext2fs/ext2_ihash.c
+++ b/sys/gnu/ext2fs/ext2_ihash.c
@@ -62,11 +62,28 @@ void
ext2_ihashinit()
{
+ KASSERT(ihashtbl == NULL, ("ext2_ihashinit called twice"));
ihashtbl = hashinit(desiredvnodes, M_EXT2IHASH, &ihash);
mtx_init(&ext2_ihash_mtx, "ext2 ihash", NULL, MTX_DEF);
}
/*
+ * Destroy the inode hash table.
+ */
+void
+ext2_ihashuninit()
+{
+ struct ihashhead *hp;
+
+ for (hp = ihashtbl; hp < &ihashtbl[ihash]; hp++)
+ if (!LIST_EMPTY(hp))
+ panic("ext2_ihashuninit: ihash not empty");
+ free(ihashtbl, M_EXT2IHASH);
+ ihashtbl = NULL;
+ mtx_destroy(&ext2_ihash_mtx);
+}
+
+/*
* 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.
*/
OpenPOWER on IntegriCloud