From ae61ec9d7879ebbc38564fd827fcae67cbbf1f8d Mon Sep 17 00:00:00 2001 From: Hiten Pandya Date: Sun, 19 Oct 2003 21:24:55 +0000 Subject: [PATCH] Un-initialise (i.e free) the HPFS inode hash; previously, unloading the HPFS module led to stray number of bytes still being allocated. 32K almost. Related to: malloc_uninit: 32768 bytes of 'HPFS hphash' still allocated on cpu0 --- sys/vfs/hpfs/hpfs.h | 4 +++- sys/vfs/hpfs/hpfs_hash.c | 17 ++++++++++++++++- sys/vfs/hpfs/hpfs_vfsops.c | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/sys/vfs/hpfs/hpfs.h b/sys/vfs/hpfs/hpfs.h index df7cfac026..ce7845a545 100644 --- a/sys/vfs/hpfs/hpfs.h +++ b/sys/vfs/hpfs/hpfs.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs.h,v 1.1 1999/12/09 19:09:58 semenu Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs.h,v 1.6 2003/08/20 09:56:32 rob Exp $ + * $DragonFly: src/sys/vfs/hpfs/hpfs.h,v 1.7 2003/10/19 21:24:55 hmp Exp $ */ /*#define HPFS_DEBUG 10*/ @@ -410,9 +410,11 @@ typedef int (vop_t) (void *); #endif extern vop_t ** hpfs_vnodeop_p; +struct vfsconf; /* Hash routines, too small to be separate header */ void hpfs_hphashinit (void); +int hpfs_hphash_uninit (struct vfsconf *); struct hpfsnode *hpfs_hphashlookup (dev_t, lsn_t); struct hpfsnode *hpfs_hphashget (dev_t, lsn_t); struct vnode *hpfs_hphashvget (dev_t, lsn_t, struct thread *); diff --git a/sys/vfs/hpfs/hpfs_hash.c b/sys/vfs/hpfs/hpfs_hash.c index 55260ad0e6..c997d7d858 100644 --- a/sys/vfs/hpfs/hpfs_hash.c +++ b/sys/vfs/hpfs/hpfs_hash.c @@ -32,7 +32,7 @@ * * @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95 * $FreeBSD: src/sys/fs/hpfs/hpfs_hash.c,v 1.1 1999/12/09 19:09:58 semenu Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_hash.c,v 1.8 2003/10/18 20:15:05 dillon Exp $ + * $DragonFly: src/sys/vfs/hpfs/hpfs_hash.c,v 1.9 2003/10/19 21:24:55 hmp Exp $ */ #include @@ -72,6 +72,21 @@ hpfs_hphashinit() lwkt_inittoken(&hpfs_hphash_token); } +/* + * Free the inode hash. + */ +int +hpfs_hphash_uninit(struct vfsconf *vfc) +{ + + lwkt_gettoken(&hpfs_hphash_token); + if (hpfs_hphashtbl) + free(hpfs_hphashtbl, M_HPFSHASH); + lwkt_reltoken(&hpfs_hphash_token); + + return 0; +} + /* * 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/vfs/hpfs/hpfs_vfsops.c b/sys/vfs/hpfs/hpfs_vfsops.c index a7a4060df8..3a305d2108 100644 --- a/sys/vfs/hpfs/hpfs_vfsops.c +++ b/sys/vfs/hpfs/hpfs_vfsops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs_vfsops.c,v 1.3.2.2 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_vfsops.c,v 1.10 2003/09/23 05:03:52 dillon Exp $ + * $DragonFly: src/sys/vfs/hpfs/hpfs_vfsops.c,v 1.11 2003/10/19 21:24:55 hmp Exp $ */ @@ -737,7 +737,7 @@ static struct vfsops hpfs_vfsops = { hpfs_checkexp, hpfs_vptofh, hpfs_init, - vfs_stduninit, + hpfs_hphash_uninit, vfs_stdextattrctl, }; VFS_SET(hpfs_vfsops, hpfs, 0); -- 2.41.0