diff options
author | luoqi <luoqi@FreeBSD.org> | 2000-01-07 08:36:44 +0000 |
---|---|---|
committer | luoqi <luoqi@FreeBSD.org> | 2000-01-07 08:36:44 +0000 |
commit | e100d44d5538cc21abeba58f459ce9eb497651a9 (patch) | |
tree | ca8740d97497e39a1d8bb5f7f15e17f85fa4c506 /sys/kern/vfs_bio.c | |
parent | e69b1ea5c9a5104ae1afe7dd26c89222983ed04e (diff) | |
download | FreeBSD-src-e100d44d5538cc21abeba58f459ce9eb497651a9.zip FreeBSD-src-e100d44d5538cc21abeba58f459ce9eb497651a9.tar.gz |
Introduce a mechanism to suspend/resume system processes. Suspend syncer
and bufdaemon prior to disk sync during system shutdown.
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r-- | sys/kern/vfs_bio.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index c24a4e0..9d2b5c2 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -29,13 +29,20 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/buf.h> +#include <sys/conf.h> +#include <sys/eventhandler.h> +#include <sys/lock.h> +#include <sys/malloc.h> +#include <sys/mount.h> #include <sys/kernel.h> -#include <sys/sysctl.h> -#include <sys/proc.h> #include <sys/kthread.h> -#include <sys/vnode.h> +#include <sys/proc.h> +#include <sys/reboot.h> +#include <sys/resourcevar.h> +#include <sys/sysctl.h> #include <sys/vmmeter.h> -#include <sys/lock.h> +#include <sys/vnode.h> #include <vm/vm.h> #include <vm/vm_param.h> #include <vm/vm_kern.h> @@ -44,11 +51,6 @@ #include <vm/vm_object.h> #include <vm/vm_extern.h> #include <vm/vm_map.h> -#include <sys/buf.h> -#include <sys/mount.h> -#include <sys/malloc.h> -#include <sys/resourcevar.h> -#include <sys/conf.h> static MALLOC_DEFINE(M_BIOBUF, "BIO buffer", "BIO buffer"); @@ -1666,6 +1668,13 @@ static void buf_daemon() { int s; + + /* + * This process needs to be suspended prior to shutdown sync. + */ + EVENTHANDLER_REGISTER(shutdown_pre_sync, shutdown_kproc, bufdaemonproc, + SHUTDOWN_PRI_LAST); + /* * This process is allowed to take the buffer cache to the limit */ @@ -1676,7 +1685,9 @@ buf_daemon() bd_flushto = hidirtybuffers; /* dynamically adjusted */ bd_flushinc = 1; - while (TRUE) { + for (;;) { + kproc_suspend_loop(bufdaemonproc); + bd_request = 0; /* |