xref: /csrg-svn/sys/ufs/lfs/lfs_bio.c (revision 51480)
151184Sbostic /*
251184Sbostic  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
351184Sbostic  * All rights reserved.
451184Sbostic  *
551184Sbostic  * %sccs.include.redist.c%
651184Sbostic  *
7*51480Sbostic  *	@(#)lfs_bio.c	5.4 (Berkeley) 11/01/91
851184Sbostic  */
951184Sbostic 
10*51480Sbostic #include <sys/param.h>
11*51480Sbostic #include <sys/proc.h>
12*51480Sbostic #include <sys/buf.h>
13*51480Sbostic #include <sys/resourcevar.h>
1451184Sbostic 
15*51480Sbostic #include <lfs/lfs.h>
16*51480Sbostic #include <lfs/lfs_extern.h>
17*51480Sbostic 
1851184Sbostic /*
1951215Sbostic  * LFS version of bawrite, bdwrite, bwrite.  Set the delayed write flag and
2051215Sbostic  * use reassignbuf to move the buffer from the clean list to the dirty one,
2151215Sbostic  * then unlock the buffer.
2251184Sbostic  */
23*51480Sbostic int
2451184Sbostic lfs_bwrite(bp)
2551184Sbostic 	register BUF *bp;
2651184Sbostic {
2751215Sbostic #ifdef DO_ACCOUNTING
2851215Sbostic 	Not included as this gets called from lots of places where the
2951215Sbostic 	current proc structure is probably wrong.  Ignore for now.
3051184Sbostic 	curproc->p_stats->p_ru.ru_oublock++;	/* XXX: no one paid yet */
3151215Sbostic #endif
3251215Sbostic 	bp->b_flags &= ~(B_READ | B_DONE | B_ERROR);
3351215Sbostic 	bp->b_flags |= B_WRITE | B_DELWRI;
3451215Sbostic 	reassignbuf(bp, bp->b_vp);		/* XXX: do this inline? */
3551184Sbostic 	brelse(bp);
36*51480Sbostic 	return (0);
3751184Sbostic }
38