summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_subr.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 13fae857831..9a362e7f4bb 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.42 1999/12/05 07:39:28 art Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.43 1999/12/05 07:54:44 art Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -1780,21 +1780,40 @@ vfs_syncwait(verbose)
int verbose;
{
register struct buf *bp;
- int iter, nbusy;
+ int iter, nbusy, dcount, s;
sys_sync(&proc0, (void *)0, (register_t *)0);
/* Wait for sync to finish. */
+ dcount = 10000;
for (iter = 0; iter < 20; iter++) {
nbusy = 0;
- for (bp = &buf[nbuf]; --bp >= buf; )
+ for (bp = &buf[nbuf]; --bp >= buf; ) {
if ((bp->b_flags & (B_BUSY|B_INVAL)) == B_BUSY)
nbusy++;
- if (nbusy == 0)
- break;
- if (verbose)
- printf("%d ", nbusy);
- DELAY(40000 * iter);
+ /*
+ * With soft updates, some buffers that are
+ * written will be remarked as dirty until other
+ * buffers are written.
+ */
+ if (bp->b_flags & B_DELWRI) {
+ s = splbio();
+ bremfree(bp);
+ bp->b_flags |= B_BUSY;
+ splx(s);
+ nbusy++;
+ bawrite(bp);
+ if (dcount-- <= 0) {
+ printf("softdep ");
+ return 1;
+ }
+ }
+ }
+ if (nbusy == 0)
+ break;
+ if (verbose)
+ printf("%d ", nbusy);
+ DELAY(40000 * iter);
}
return nbusy;