Are you using NTFS? Probably not. So why have you reserved 16K for the
NTFS hash table?
We can postpone nthashinit() until mount and save memory for people
who aren't using ntfs. Also, the other init function, toupper_init,
doesn't do anything at all.
Index: ntfs_ihash.c
===================================================================
RCS file: /cvs/src/sys/ntfs/ntfs_ihash.c,v
retrieving revision 1.13
diff -u -p -r1.13 ntfs_ihash.c
--- ntfs_ihash.c 30 May 2013 20:11:06 -0000 1.13
+++ ntfs_ihash.c 17 Jan 2014 05:07:34 -0000
@@ -60,8 +60,19 @@ struct rwlock ntfs_hashlock = RWLOCK_INI
void
ntfs_nthashinit(void)
{
- ntfs_nthashtbl = hashinit(desiredvnodes, M_NTFSNTHASH, M_WAITOK,
- &ntfs_nthash);
+ u_long nthash;
+ void *nthashtbl;
+
+ if (ntfs_nthashtbl)
+ return;
+
+ nthashtbl = hashinit(desiredvnodes, M_NTFSNTHASH, M_WAITOK, &nthash);
+ if (ntfs_nthashtbl) {
+ free(nthashtbl, M_NTFSNTHASH);
+ return;
+ }
+ ntfs_nthashtbl = nthashtbl;
+ ntfs_nthash = nthash;
}
/*
Index: ntfs_subr.c
===================================================================
RCS file: /cvs/src/sys/ntfs/ntfs_subr.c,v
retrieving revision 1.36
diff -u -p -r1.36 ntfs_subr.c
--- ntfs_subr.c 2 Dec 2013 16:23:16 -0000 1.36
+++ ntfs_subr.c 17 Jan 2014 05:02:08 -0000
@@ -1877,17 +1877,6 @@ ntfs_runtocn(cn_t *cn, struct ntfsmount
#endif
/*
- * this initializes toupper table & dependant variables to be ready for
- * later work
- */
-void
-ntfs_toupper_init(void)
-{
- ntfs_toupper_tab = (wchar *) NULL;
- ntfs_toupper_usecount = 0;
-}
-
-/*
* if the ntfs_toupper_tab[] is filled already, just raise use count;
* otherwise read the data from the filesystem we are currently mounting
*/
Index: ntfs_subr.h
===================================================================
RCS file: /cvs/src/sys/ntfs/ntfs_subr.h,v
retrieving revision 1.8
diff -u -p -r1.8 ntfs_subr.h
--- ntfs_subr.h 2 Dec 2013 16:19:08 -0000 1.8
+++ ntfs_subr.h 17 Jan 2014 05:07:58 -0000
@@ -93,7 +93,6 @@ void ntfs_ntrele(struct ntnode *);
int ntfs_loadntnode( struct ntfsmount *, struct ntnode * );
int ntfs_writentvattr_plain(struct ntfsmount *, struct ntnode *, struct
ntvattr *, off_t, size_t, void *, size_t *, struct uio *);
int ntfs_writeattr_plain(struct ntfsmount *, struct ntnode *, u_int32_t, char
*, off_t, size_t, void *, size_t *, struct uio *);
-void ntfs_toupper_init(void);
int ntfs_fget(struct ntfsmount *, struct ntnode *, int, char *, struct fnode
**);
void ntfs_frele(struct fnode *);
int ntfs_ntreaddir(struct ntfsmount *, struct fnode *, u_int32_t, struct
attr_indexentry **, struct proc *);
Index: ntfs_vfsops.c
===================================================================
RCS file: /cvs/src/sys/ntfs/ntfs_vfsops.c,v
retrieving revision 1.37
diff -u -p -r1.37 ntfs_vfsops.c
--- ntfs_vfsops.c 2 Dec 2013 16:05:07 -0000 1.37
+++ ntfs_vfsops.c 17 Jan 2014 05:02:24 -0000
@@ -113,8 +113,6 @@ ntfs_sysctl(int *name, u_int namelen, vo
int
ntfs_init(struct vfsconf *vcp)
{
- ntfs_nthashinit();
- ntfs_toupper_init();
return 0;
}
@@ -128,6 +126,8 @@ ntfs_mount(struct mount *mp, const char
char fname[MNAMELEN];
char fspec[MNAMELEN];
mode_t amode;
+
+ ntfs_nthashinit();
/*
***