LFS version 2; no changes required
[unix-history] / usr / src / sys / ufs / lfs / lfs_bio.c
CommitLineData
8c6ec179 1/*
785154a8 2 * Copyright (c) 1991 Regents of the University of California.
8c6ec179
KB
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 *
9a1dcf8a 7 * @(#)lfs_bio.c 7.2 (Berkeley) %G%
8c6ec179
KB
8 */
9
a5219e6e
KB
10#include <sys/param.h>
11#include <sys/proc.h>
12#include <sys/buf.h>
13#include <sys/resourcevar.h>
14
785154a8
KB
15#include <ufs/lfs/lfs.h>
16#include <ufs/lfs/lfs_extern.h>
8c6ec179 17
a5219e6e 18int
8c6ec179
KB
19lfs_bwrite(bp)
20 register BUF *bp;
21{
9a1dcf8a
KB
22#ifdef VERBOSE
23printf("lfs_bwrite\n");
24#endif
25 /*
26 *
27 * LFS version of bawrite, bdwrite, bwrite. Set the delayed write
28 * flag and use reassignbuf to move the buffer from the clean list
29 * to the dirty one, then unlock the buffer. Note, we set the
30 * B_LOCKED flag, which causes brelse to move the buffer onto the
31 * LOCKED free list. This is necessary, otherwise getnewbuf() would
32 * try to reclaim them using bawrite, which isn't going to work.
33 *
34 * XXX
35 * No accounting for the cost of the write is currently done.
36 * This is almost certainly wrong for synchronous operations, i.e. NFS.
37 */
275ca4f0 38 bp->b_flags &= ~(B_READ | B_DONE | B_ERROR);
9a1dcf8a
KB
39 bp->b_flags |= B_DELWRI | B_LOCKED;
40 reassignbuf(bp, bp->b_vp);
8c6ec179 41 brelse(bp);
a5219e6e 42 return (0);
8c6ec179 43}