summaryrefslogtreecommitdiff
path: root/sys/ufs/ffs
diff options
context:
space:
mode:
authorGrigoriy Orlov <gluk@cvs.openbsd.org>2001-09-10 08:48:43 +0000
committerGrigoriy Orlov <gluk@cvs.openbsd.org>2001-09-10 08:48:43 +0000
commit60d5f3573fef0e8bd3308dd339a5de6195fbb33a (patch)
tree8a3d4536794f8f4d7b68b6bebc88a9da2f83c09d /sys/ufs/ffs
parent3d8a07c4d7807081d3e435f655dfe9d5b86f697a (diff)
Mark buffers with dependencies as B_DEFERRED and skip them one time
when doing sync. From FreeBSD. art@ ok.
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r--sys/ufs/ffs/ffs_vnops.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 3dac84c2203..dae8b5c9528 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vnops.c,v 1.18 2001/06/27 04:58:48 art Exp $ */
+/* $OpenBSD: ffs_vnops.c,v 1.19 2001/09/10 08:48:42 gluk Exp $ */
/* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */
/*
@@ -251,12 +251,28 @@ loop:
bp->b_flags &= ~B_SCANNED;
for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
nbp = LIST_NEXT(bp, b_vnbufs);
+ /*
+ * Reasons to skip this buffer: it has already been considered
+ * on this pass, this pass is the first time through on a
+ * synchronous flush request and the buffer being considered
+ * is metadata, the buffer has dependencies that will cause
+ * it to be redirtied and it has not already been deferred,
+ * or it is already being written.
+ */
if (bp->b_flags & (B_BUSY | B_SCANNED))
continue;
if ((bp->b_flags & B_DELWRI) == 0)
panic("ffs_fsync: not dirty");
if (skipmeta && bp->b_lblkno < 0)
continue;
+ if (ap->a_waitfor != MNT_WAIT &&
+ LIST_FIRST(&bp->b_dep) != NULL &&
+ (bp->b_flags & B_DEFERRED) == 0 &&
+ buf_countdeps(bp, 0, 1)) {
+ bp->b_flags |= B_DEFERRED;
+ continue;
+ }
+
bremfree(bp);
bp->b_flags |= B_BUSY | B_SCANNED;
splx(s);