LFS version 2; use B_LOCKED queue for buffers
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 7 Dec 1991 08:37:28 +0000 (00:37 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 7 Dec 1991 08:37:28 +0000 (00:37 -0800)
SCCS-vsn: sys/ufs/lfs/lfs_bio.c 7.2

usr/src/sys/ufs/lfs/lfs_bio.c

index 707bf15..3b38ef7 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_bio.c   7.1 (Berkeley) %G%
+ *     @(#)lfs_bio.c   7.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
 #include <ufs/lfs/lfs.h>
 #include <ufs/lfs/lfs_extern.h>
 
 #include <ufs/lfs/lfs.h>
 #include <ufs/lfs/lfs_extern.h>
 
-/*
- * LFS version of bawrite, bdwrite, bwrite.  Set the delayed write flag and
- * use reassignbuf to move the buffer from the clean list to the dirty one,
- * then unlock the buffer.
- *
- * XXX No accounting for the cost of the write is currently done.
- * XXX This is almost certainly wrong for synchronous operations, i.e. NFS.
- */
 int
 lfs_bwrite(bp)
        register BUF *bp;
 {
 int
 lfs_bwrite(bp)
        register BUF *bp;
 {
+#ifdef VERBOSE
+printf("lfs_bwrite\n");
+#endif
+       /*
+        *
+        * LFS version of bawrite, bdwrite, bwrite.  Set the delayed write
+        * flag and use reassignbuf to move the buffer from the clean list
+        * to the dirty one, then unlock the buffer.  Note, we set the
+        * B_LOCKED flag, which causes brelse to move the buffer onto the
+        * LOCKED free list.  This is necessary, otherwise getnewbuf() would
+        * try to reclaim them using bawrite, which isn't going to work.
+        *
+        * XXX
+        * No accounting for the cost of the write is currently done.
+        * This is almost certainly wrong for synchronous operations, i.e. NFS.
+        */
        bp->b_flags &= ~(B_READ | B_DONE | B_ERROR);
        bp->b_flags &= ~(B_READ | B_DONE | B_ERROR);
-       bp->b_flags |= B_WRITE | B_DELWRI;
-       reassignbuf(bp, bp->b_vp);              /* XXX: do this inline? */
+       bp->b_flags |= B_DELWRI | B_LOCKED;
+       reassignbuf(bp, bp->b_vp);
        brelse(bp);
        return (0);
 }
        brelse(bp);
        return (0);
 }