/* All node lock to protect the node list and tmp_pages_used */
struct lock allnode_lock;
- /* Per-mount malloc zone for tmpfs nodes */
+ /* Per-mount malloc zones for tmpfs nodes and dirents */
struct malloc_type *tm_node_zone;
+ struct malloc_type *tm_dirent_zone;
+
struct objcache_malloc_args tm_node_zone_malloc_args;
+ struct objcache_malloc_args tm_dirent_zone_malloc_args;
/* Pools used to store file system meta data. These are not shared
* across several instances of tmpfs for the reasons described in
MALLOC_DEFINE(M_TMPFSMNT, "tmpfs mount", "tmpfs mount structures");
MALLOC_DEFINE(M_TMPFSNAME, "tmpfs name", "tmpfs file names");
-MALLOC_DEFINE(M_TMPFS_DIRENT, "tmpfs dirent", "tmpfs dirent structures");
/* --------------------------------------------------------------------- */
objcache_malloc_free(obj, args);
}
-struct objcache_malloc_args tmpfs_dirent_pool_malloc_args =
- { sizeof(struct tmpfs_dirent), M_TMPFS_DIRENT };
-
static int
tmpfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
{
tmp->tm_pages_used = 0;
kmalloc_create(&tmp->tm_node_zone, "tmpfs node");
+ kmalloc_create(&tmp->tm_dirent_zone, "tmpfs dirent");
kmalloc_raise_limit(tmp->tm_node_zone, sizeof(struct tmpfs_node) *
tmp->tm_nodes_max);
tmp->tm_node_zone_malloc_args.objsize = sizeof(struct tmpfs_node);
tmp->tm_node_zone_malloc_args.mtype = tmp->tm_node_zone;
+ tmp->tm_dirent_zone_malloc_args.objsize = sizeof(struct tmpfs_dirent);
+ tmp->tm_dirent_zone_malloc_args.mtype = tmp->tm_dirent_zone;
+
tmp->tm_dirent_pool = objcache_create( "tmpfs dirent cache",
0, 0,
NULL, NULL, NULL,
objcache_malloc_alloc, objcache_malloc_free,
- &tmpfs_dirent_pool_malloc_args);
+ &tmp->tm_dirent_zone_malloc_args);
tmp->tm_node_pool = objcache_create( "tmpfs node cache",
0, 0,
tmpfs_node_ctor, tmpfs_node_dtor, NULL,
objcache_destroy(tmp->tm_dirent_pool);
objcache_destroy(tmp->tm_node_pool);
+ kmalloc_destroy(&tmp->tm_dirent_zone);
kmalloc_destroy(&tmp->tm_node_zone);
+ tmp->tm_node_zone = tmp->tm_dirent_zone = NULL;
+
lockuninit(&tmp->allnode_lock);
KKASSERT(tmp->tm_pages_used == 0);
KKASSERT(tmp->tm_nodes_inuse == 0);