tmpfs: use unr64 for inode numbers

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mateusz Guzik 2018-11-20 15:14:30 +00:00
parent cafcdfd00f
commit 30e0cf499f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340679
3 changed files with 3 additions and 13 deletions

View File

@ -353,7 +353,7 @@ struct tmpfs_mount {
ino_t tm_nodes_max;
/* unrhdr used to allocate inode numbers */
struct unrhdr * tm_ino_unr;
struct unrhdr64 tm_ino_unr;
/* Number of nodes currently that are in use. */
ino_t tm_nodes_inuse;

View File

@ -230,7 +230,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type,
nnode->tn_uid = uid;
nnode->tn_gid = gid;
nnode->tn_mode = mode;
nnode->tn_id = alloc_unr(tmp->tm_ino_unr);
nnode->tn_id = alloc_unr64(&tmp->tm_ino_unr);
nnode->tn_refcount = 1;
/* Type-specific initialization. */
@ -368,13 +368,6 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node,
panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type);
}
/*
* If we are unmounting there is no need for going through the overhead
* of freeing the inodes from the unr individually, so free them all in
* one go later.
*/
if (!detach)
free_unr(tmp->tm_ino_unr, node->tn_id);
uma_zfree(tmp->tm_node_pool, node);
TMPFS_LOCK(tmp);
tmpfs_free_tmp(tmp);

View File

@ -231,7 +231,7 @@ tmpfs_mount(struct mount *mp)
tmp->tm_pages_max = pages;
tmp->tm_pages_used = 0;
tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->tm_allnode_lock);
new_unrhdr64(&tmp->tm_ino_unr, 2);
tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent",
sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL,
UMA_ALIGN_PTR, 0);
@ -248,7 +248,6 @@ tmpfs_mount(struct mount *mp)
if (error != 0 || root == NULL) {
uma_zdestroy(tmp->tm_node_pool);
uma_zdestroy(tmp->tm_dirent_pool);
delete_unrhdr(tmp->tm_ino_unr);
free(tmp, M_TMPFSMNT);
return (error);
}
@ -343,8 +342,6 @@ tmpfs_free_tmp(struct tmpfs_mount *tmp)
uma_zdestroy(tmp->tm_dirent_pool);
uma_zdestroy(tmp->tm_node_pool);
clear_unrhdr(tmp->tm_ino_unr);
delete_unrhdr(tmp->tm_ino_unr);
mtx_destroy(&tmp->tm_allnode_lock);
MPASS(tmp->tm_pages_used == 0);