When unmounting a tmpfs, do not call free_unr.

tmpfs uses unr(9) to allocate inodes. Previously when unmounting it
would individually free the units when it freed each vnode. This is
unnecessary as we can use the newly-added unrhdr_clear function to clear
out the unr in onde go. This measurably reduces the time to unmount a
tmpfs with many files.

Reviewed by:	cem, lidl
Approved by:	rstone (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12591
This commit is contained in:
mjoras 2017-10-11 21:53:53 +00:00
parent 1bac95586a
commit 851d0b97ab
2 changed files with 9 additions and 1 deletions

View File

@ -362,7 +362,13 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node,
panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type);
}
free_unr(tmp->tm_ino_unr, node->tn_id);
/*
* 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

@ -317,6 +317,8 @@ tmpfs_unmount(struct mount *mp, int mntflags)
TMPFS_NODE_UNLOCK(node);
}
clear_unrhdr(tmp->tm_ino_unr);
mp->mnt_data = NULL;
tmpfs_free_tmp(tmp);
vfs_write_resume(mp, VR_START_WRITE);