1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-06 13:09:50 +00:00

Use EVENTHANDLER_DIRECT_INVOKE for [un]mount events, for better performance.

This commit is contained in:
Ian Lepore 2018-01-07 18:07:22 +00:00
parent f031a3b25f
commit ac579135b0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327679

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/jail.h>
#include <sys/kernel.h>
@ -91,6 +92,9 @@ struct mntlist mountlist = TAILQ_HEAD_INITIALIZER(mountlist);
struct mtx mountlist_mtx;
MTX_SYSINIT(mountlist, &mountlist_mtx, "mountlist", MTX_DEF);
EVENTHANDLER_LIST_DEFINE(vfs_mounted);
EVENTHANDLER_LIST_DEFINE(vfs_unmounted);
/*
* Global opts, taken by all filesystems
*/
@ -865,7 +869,7 @@ vfs_domount_first(
if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp))
panic("mount: lost mount");
VOP_UNLOCK(vp, 0);
EVENTHANDLER_INVOKE(vfs_mounted, mp, newdp, td);
EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
VOP_UNLOCK(newdp, 0);
mountcheckdirs(vp, newdp);
vrele(newdp);
@ -1401,7 +1405,7 @@ dounmount(struct mount *mp, int flags, struct thread *td)
mtx_lock(&mountlist_mtx);
TAILQ_REMOVE(&mountlist, mp, mnt_list);
mtx_unlock(&mountlist_mtx);
EVENTHANDLER_INVOKE(vfs_unmounted, mp, td);
EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
if (coveredvp != NULL) {
coveredvp->v_mountedhere = NULL;
VOP_UNLOCK(coveredvp, 0);