summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_sync.c31
-rw-r--r--sys/sys/mount.h3
2 files changed, 31 insertions, 3 deletions
diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c
index cb3de524a81..7f4c7a579ff 100644
--- a/sys/kern/vfs_sync.c
+++ b/sys/kern/vfs_sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_sync.c,v 1.8 1999/12/05 06:29:30 art Exp $ */
+/* $OpenBSD: vfs_sync.c,v 1.9 1999/12/05 06:56:35 art Exp $ */
/*
@@ -63,7 +63,9 @@
#define SYNCER_DEFAULT 30 /* default sync delay time */
int syncer_maxdelay = SYNCER_MAXDELAY; /* maximum delay time */
time_t syncdelay = SYNCER_DEFAULT; /* time to delay syncing vnodes */
-int rushjob; /* number of slots to run ASAP */
+
+int rushjob = 0; /* number of slots to run ASAP */
+int stat_rush_requests = 0; /* number of rush requests */
static int syncer_delayno = 0;
static long syncer_last;
@@ -72,6 +74,8 @@ static struct synclist *syncer_workitem_pending;
extern struct simplelock mountlist_slock;
+struct proc *syncerproc;
+
/*
* The workitem queue.
*
@@ -148,6 +152,8 @@ sched_sync(p)
long starttime;
int s;
+ syncerproc = curproc;
+
for (;;) {
starttime = time.tv_sec;
@@ -209,6 +215,27 @@ sched_sync(p)
}
}
+/*
+ * Request the syncer daemon to speed up its work.
+ * We never push it to speed up more than half of its
+ * normal turn time, otherwise it could take over the cpu.
+ */
+int
+speedup_syncer()
+{
+ int s;
+
+ s = splhigh();
+ if (syncerproc && syncerproc->p_wchan == &lbolt)
+ setrunnable(syncerproc);
+ splx(s);
+ if (rushjob < syncdelay / 2) {
+ rushjob += 1;
+ stat_rush_requests += 1;
+ return 1;
+ }
+ return 0;
+}
/*
* Routine to create and manage a filesystem syncer vnode.
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 4e323dc71f9..debda5397ae 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.h,v 1.31 1999/07/02 23:35:53 deraadt Exp $ */
+/* $OpenBSD: mount.h,v 1.32 1999/12/05 06:56:34 art Exp $ */
/* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */
/*
@@ -539,6 +539,7 @@ int vfs_export /* process mount export info */
struct netcred *vfs_export_lookup /* lookup host in fs export list */
__P((struct mount *, struct netexport *, struct mbuf *));
int vfs_allocate_syncvnode __P((struct mount *));
+int speedup_syncer __P((void));
int vfs_syncwait __P((int)); /* sync and wait for complete */
void vfs_shutdown __P((void)); /* unmount and sync file systems */