diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 345aad6a3d63..b4dde0697496 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1773,6 +1773,8 @@ sync_vnode(struct synclist *slp, struct bufobj **bo, struct thread *td) return (0); } +static int first_printf = 1; + /* * System filesystem synchronizer daemon. */ @@ -1791,7 +1793,6 @@ sched_sync(void) last_work_seen = 0; syncer_final_iter = 0; - first_printf = 1; syncer_state = SYNCER_RUNNING; starttime = time_uptime; td->td_pflags |= TDP_NORUNNINGBUF; @@ -1955,6 +1956,25 @@ syncer_shutdown(void *arg, int howto) kproc_shutdown(arg, howto); } +void +syncer_suspend(void) +{ + + syncer_shutdown(updateproc, 0); +} + +void +syncer_resume(void) +{ + + mtx_lock(&sync_mtx); + first_printf = 1; + syncer_state = SYNCER_RUNNING; + mtx_unlock(&sync_mtx); + cv_broadcast(&sync_wakeup); + kproc_resume(updateproc); +} + /* * Reassign a buffer from one vnode to another. * Used to assign file specific control information diff --git a/sys/sys/mount.h b/sys/sys/mount.h index c4e1145d809d..6fb2d08187b7 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -917,6 +917,9 @@ vfs_uninit_t vfs_stduninit; vfs_extattrctl_t vfs_stdextattrctl; vfs_sysctl_t vfs_stdsysctl; +void syncer_suspend(void); +void syncer_resume(void); + #else /* !_KERNEL */ #include