151184Sbostic /* 251493Sbostic * Copyright (c) 1991 Regents of the University of California. 351184Sbostic * All rights reserved. 451184Sbostic * 551184Sbostic * %sccs.include.redist.c% 651184Sbostic * 7*51913Sbostic * @(#)lfs_bio.c 7.3 (Berkeley) 12/13/91 851184Sbostic */ 951184Sbostic 1051480Sbostic #include <sys/param.h> 1151480Sbostic #include <sys/proc.h> 1251480Sbostic #include <sys/buf.h> 1351480Sbostic #include <sys/resourcevar.h> 1451184Sbostic 1551493Sbostic #include <ufs/lfs/lfs.h> 1651493Sbostic #include <ufs/lfs/lfs_extern.h> 1751480Sbostic 1851480Sbostic int 1951184Sbostic lfs_bwrite(bp) 2051184Sbostic register BUF *bp; 2151184Sbostic { 2251851Sbostic #ifdef VERBOSE 2351851Sbostic printf("lfs_bwrite\n"); 2451851Sbostic #endif 2551851Sbostic /* 2651851Sbostic * LFS version of bawrite, bdwrite, bwrite. Set the delayed write 2751851Sbostic * flag and use reassignbuf to move the buffer from the clean list 2851851Sbostic * to the dirty one, then unlock the buffer. Note, we set the 2951851Sbostic * B_LOCKED flag, which causes brelse to move the buffer onto the 3051851Sbostic * LOCKED free list. This is necessary, otherwise getnewbuf() would 3151851Sbostic * try to reclaim them using bawrite, which isn't going to work. 3251851Sbostic * 3351851Sbostic * XXX 3451851Sbostic * No accounting for the cost of the write is currently done. 3551851Sbostic * This is almost certainly wrong for synchronous operations, i.e. NFS. 3651851Sbostic */ 37*51913Sbostic bp->b_flags |= B_DELWRI | B_LOCKED; 3851215Sbostic bp->b_flags &= ~(B_READ | B_DONE | B_ERROR); 3951851Sbostic reassignbuf(bp, bp->b_vp); 4051184Sbostic brelse(bp); 4151480Sbostic return (0); 4251184Sbostic } 43