From 0b64164fca054b2e66a717e118bdadfc34158bbf Mon Sep 17 00:00:00 2001 From: "Justin T. Gibbs" Date: Fri, 6 Sep 1996 05:37:53 +0000 Subject: [PATCH] Add bowrite. Bowrite guarantees that buffers queued after a call to bowrite will be written after the specified buffer (on a particular device). Bowrite does this either by taking advantage of hardware ordering support (e.g. tagged queueing on SCSI devices) or resorting to a synchronous write. --- sys/kern/vfs_bio.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index b278f6c64b3..e9fa85fb446 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -18,7 +18,7 @@ * 5. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: vfs_bio.c,v 1.95 1996/08/04 20:13:08 phk Exp $ + * $Id: vfs_bio.c,v 1.96 1996/08/21 21:55:18 dyson Exp $ */ /* @@ -313,7 +313,7 @@ bwrite(struct buf * bp) curproc->p_stats->p_ru.ru_oublock++; VOP_STRATEGY(bp); - if ((oldflags & B_ASYNC) == 0) { + if ((bp->b_flags & B_ASYNC) == 0) { int rtval = biowait(bp); if (oldflags & B_DELWRI) { @@ -398,6 +398,21 @@ bawrite(struct buf * bp) (void) VOP_BWRITE(bp); } +/* + * Ordered write. + * Start output on a buffer, but only wait for it to complete if the + * output device cannot guarantee ordering in some other way. Devices + * that can perform asyncronous ordered writes will set the B_ASYNC + * flag in their strategy routine. + * The buffer is released when the output completes. + */ +int +bowrite(struct buf * bp) +{ + bp->b_flags |= B_ORDERED; + return (VOP_BWRITE(bp)); +} + /* * Release a buffer. */