From ac579135b0a755f140649297ea22fee7f5f9c9c3 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Sun, 7 Jan 2018 18:07:22 +0000 Subject: [PATCH] Use EVENTHANDLER_DIRECT_INVOKE for [un]mount events, for better performance. --- sys/kern/vfs_mount.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index dd28dce8567e..070a56c85db1 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -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);