diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1999-12-05 07:54:45 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1999-12-05 07:54:45 +0000 |
commit | e690db303b6664ee0669697c9e72c4aef8d7e5cd (patch) | |
tree | 63fe29143bd356e15f8dbc2b2afa6ca3b73c16f6 /sys/kern/vfs_subr.c | |
parent | b02d4b5f2472fe79f7ca1d9fea7d3079b31b19b4 (diff) |
With soft updates, some buffers will be remarked as dirty after being written.
Handle this when syncing filesystems when unmounting.
From NetBSD.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 35 |
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; |