From f5bbdfba4138afa70ecf92850a1f7cb22e7f5a12 Mon Sep 17 00:00:00 2001 From: cgd Date: Wed, 12 Jul 1995 07:56:31 +0000 Subject: [PATCH] bdwrite() should upgrade writes to tape devices by sending them to bawrite(). it's logically more correct (doesn't return an error code, because it's async; bdwrite is also async), it still writes things in-order, it makes sure the proper accountins is done (see the wasdelayed cases in bwrite()), and it allows writes to vnodes on volumes mountd with the MNT_ASYNC to be converted into delayed writes the way God, err, Kirk intended. Convert synchronous bwrite()s on MNT_ASYNC file systems to delayed writes. --- sys/kern/vfs_bio.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index a5969e78f305..4b36e0eadacb 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_bio.c,v 1.37 1995/07/12 07:39:00 cgd Exp $ */ +/* $NetBSD: vfs_bio.c,v 1.38 1995/07/12 07:56:31 cgd Exp $ */ /*- * Copyright (c) 1994 Christopher G. Demetriou @@ -267,15 +267,19 @@ bwrite(bp) { int rv, s, sync, wasdelayed; - /* Remember buffer type, to switch on it later. */ + /* + * Remember buffer type, to switch on it later. If the write was + * synchronous, but the file system was mounted with MNT_ASYNC, + * convert it to a delayed write. + * XXX note that this relies on delayed tape writes being converted + * to async, not sync writes (which is safe, but ugly). + */ sync = !ISSET(bp->b_flags, B_ASYNC); -#if 0 if (sync && bp->b_vp && bp->b_vp->v_mount && ISSET(bp->b_vp->v_mount->mnt_flag, MNT_ASYNC)) { bdwrite(bp); return (0); } -#endif wasdelayed = ISSET(bp->b_flags, B_DELWRI); CLR(bp->b_flags, (B_READ | B_DONE | B_ERROR | B_DELWRI)); @@ -362,7 +366,7 @@ bdwrite(bp) /* If this is a tape block, write the block now. */ if (bdevsw[major(bp->b_dev)].d_type == D_TAPE) { - bwrite(bp); + bawrite(bp); return; }