mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Remove the bogus SYSINIT from ufs_dirhash.c and instead add a call
to ufsdirhash_init() from ufs_init(). Add uninit() functions corresponding the ufs, dirhash, quota and ihash init() functions.
This commit is contained in:
parent
c21c16a492
commit
3423b21c09
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99101
@ -108,6 +108,8 @@ struct dirhash {
|
||||
/*
|
||||
* Dirhash functions.
|
||||
*/
|
||||
void ufsdirhash_init(void);
|
||||
void ufsdirhash_uninit(void);
|
||||
int ufsdirhash_build(struct inode *);
|
||||
doff_t ufsdirhash_findfree(struct inode *, int, int *);
|
||||
doff_t ufsdirhash_enduseful(struct inode *);
|
||||
|
@ -182,6 +182,7 @@ int chkdq(struct inode *, int64_t, struct ucred *, int);
|
||||
int chkiq(struct inode *, ino_t, struct ucred *, int);
|
||||
void dqinit(void);
|
||||
void dqrele(struct vnode *, struct dquot *);
|
||||
void dquninit(void);
|
||||
int getinoquota(struct inode *);
|
||||
int getquota(struct mount *, u_long, int, caddr_t);
|
||||
int qsync(struct mount *mp);
|
||||
|
@ -85,7 +85,6 @@ static void ufsdirhash_delslot(struct dirhash *dh, int slot);
|
||||
static int ufsdirhash_findslot(struct dirhash *dh, char *name, int namelen,
|
||||
doff_t offset);
|
||||
static doff_t ufsdirhash_getprev(struct direct *dp, doff_t offset);
|
||||
static void ufsdirhash_init(void);
|
||||
static int ufsdirhash_recycle(int wanted);
|
||||
|
||||
static uma_zone_t ufsdirhash_zone;
|
||||
@ -1059,7 +1058,7 @@ ufsdirhash_recycle(int wanted)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
void
|
||||
ufsdirhash_init()
|
||||
{
|
||||
ufsdirhash_zone = uma_zcreate("DIRHASH", DH_NBLKOFF * sizeof(doff_t),
|
||||
@ -1067,7 +1066,13 @@ ufsdirhash_init()
|
||||
mtx_init(&ufsdirhash_mtx, "dirhash list", NULL, MTX_DEF);
|
||||
TAILQ_INIT(&ufsdirhash_list);
|
||||
}
|
||||
SYSINIT(ufsdirhash, SI_SUB_PSEUDO, SI_ORDER_ANY, ufsdirhash_init, NULL)
|
||||
|
||||
void
|
||||
ufsdirhash_uninit()
|
||||
{
|
||||
KASSERT(TAILQ_EMPTY(&ufsdirhash_list), ("ufsdirhash_uninit"));
|
||||
uma_zdestroy(ufsdirhash_zone);
|
||||
mtx_destroy(&ufsdirhash_mtx);
|
||||
}
|
||||
|
||||
#endif /* UFS_DIRHASH */
|
||||
|
@ -80,6 +80,7 @@ int ufs_ihashins(struct inode *, int, struct vnode **);
|
||||
struct vnode *
|
||||
ufs_ihashlookup(dev_t, ino_t);
|
||||
void ufs_ihashrem(struct inode *);
|
||||
void ufs_ihashuninit(void);
|
||||
int ufs_inactive(struct vop_inactive_args *);
|
||||
int ufs_init(struct vfsconf *);
|
||||
void ufs_itimes(struct vnode *vp);
|
||||
@ -89,6 +90,7 @@ int ufs_reclaim(struct vop_reclaim_args *);
|
||||
void ffs_snapgone(struct inode *);
|
||||
int ufs_root(struct mount *, struct vnode **);
|
||||
int ufs_start(struct mount *, int, struct thread *);
|
||||
int ufs_uninit(struct vfsconf *);
|
||||
int ufs_vinit(struct mount *, vop_t **, vop_t **, struct vnode **);
|
||||
|
||||
/*
|
||||
|
@ -67,6 +67,17 @@ ufs_ihashinit()
|
||||
mtx_init(&ufs_ihash_mtx, "ufs ihash", NULL, MTX_DEF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroy the inode hash table.
|
||||
*/
|
||||
void
|
||||
ufs_ihashuninit()
|
||||
{
|
||||
|
||||
hashdestroy(ihashtbl, M_UFSIHASH, ihash);
|
||||
mtx_destroy(&ufs_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.
|
||||
|
@ -753,6 +753,21 @@ dqinit()
|
||||
TAILQ_INIT(&dqfreelist);
|
||||
}
|
||||
|
||||
/*
|
||||
* Shut down the quota system.
|
||||
*/
|
||||
void
|
||||
dquninit()
|
||||
{
|
||||
struct dquot *dq;
|
||||
|
||||
hashdestroy(dqhashtbl, M_DQUOT, dqhash);
|
||||
while ((dq = TAILQ_FIRST(&dqfreelist)) != NULL) {
|
||||
TAILQ_REMOVE(&dqfreelist, dq, dq_freelist);
|
||||
free(dq, M_DQUOT);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Obtain a dquot structure for the specified identifier and quota file
|
||||
* reading the information from the file if necessary.
|
||||
|
@ -40,6 +40,7 @@
|
||||
*/
|
||||
|
||||
#include "opt_quota.h"
|
||||
#include "opt_ufs.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -56,6 +57,10 @@
|
||||
#include <ufs/ufs/inode.h>
|
||||
#include <ufs/ufs/ufsmount.h>
|
||||
#include <ufs/ufs/ufs_extern.h>
|
||||
#ifdef UFS_DIRHASH
|
||||
#include <ufs/ufs/dir.h>
|
||||
#include <ufs/ufs/dirhash.h>
|
||||
#endif
|
||||
|
||||
MALLOC_DEFINE(M_UFSMNT, "UFS mount", "UFS mount structure");
|
||||
/*
|
||||
@ -171,14 +176,31 @@ int
|
||||
ufs_init(vfsp)
|
||||
struct vfsconf *vfsp;
|
||||
{
|
||||
static int done;
|
||||
|
||||
if (done)
|
||||
return (0);
|
||||
done = 1;
|
||||
ufs_ihashinit();
|
||||
#ifdef QUOTA
|
||||
dqinit();
|
||||
#endif
|
||||
#ifdef UFS_DIRHASH
|
||||
ufsdirhash_init();
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Uninitialise UFS filesystems, done before module unload.
|
||||
*/
|
||||
int
|
||||
ufs_uninit(vfsp)
|
||||
struct vfsconf *vfsp;
|
||||
{
|
||||
|
||||
ufs_ihashuninit();
|
||||
#ifdef QUOTA
|
||||
dquninit();
|
||||
#endif
|
||||
#ifdef UFS_DIRHASH
|
||||
ufsdirhash_uninit();
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user