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.
This commit is contained in:
parent
9c3fe30d92
commit
f5bbdfba41
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user