FreeBSD/sys/ufs/ffs/ffs_vfsops.c
/*
 * Complete a background write started from bwrite.
 */
Complete a background write started from bwrite.
Complete a background write started from bwrite .
static void
ffs_backgroundwritedone(struct buf *bp)
{
	struct bufobj *bufobj;
	struct buf *origbp;
	bufobj = bp->b_bufobj;
	BO_LOCK(bufobj);
	if ((origbp = gbincore(bp->b_bufobj, bp->b_lblkno)) == NULL)
		panic("backgroundwritedone: lost buffer");
	if ((bp->b_ioflags & BIO_ERROR) != 0)
		origbp->b_vflags |= BV_BKGRDERR;
	BO_UNLOCK(bufobj);
	pbrelvp(bp);
	if (!LIST_EMPTY(&bp->b_dep) && (bp->b_ioflags & BIO_ERROR) == 0)
		buf_complete(bp);
#ifdef SOFTUPDATES
	if (!LIST_EMPTY(&bp->b_dep))
		softdep_move_dependencies(bp, origbp);
#endif
	bp->b_flags |= B_NOCACHE;
	bp->b_flags &= ~B_CACHE;
	if ((bp->b_ioflags & BIO_ERROR) != 0)
		bp->b_flags |= B_INVAL;
	bufdone(bp);
	BO_LOCK(bufobj);
	KASSERT((origbp->b_vflags & BV_BKGRDINPROG),
	    ("backgroundwritedone: lost buffer2"));
	origbp->b_vflags &= ~BV_BKGRDINPROG;
	if (origbp->b_vflags & BV_BKGRDWAIT) {
		origbp->b_vflags &= ~BV_BKGRDWAIT;
		wakeup(&origbp->b_xflags);
	}
	BO_UNLOCK(bufobj);
}
static void ffs_backgroundwritedone ( struct buf * bp ) { struct bufobj * bufobj ; struct buf * origbp ; bufobj = bp -> b_bufobj ; BO_LOCK ( bufobj ) ; if ( ( origbp = gbincore ( bp -> b_bufobj , bp -> b_lblkno ) ) == NULL ) panic ( " " ) ; if ( ( bp -> b_ioflags & BIO_ERROR ) != 0 ) origbp -> b_vflags |= BV_BKGRDERR ; BO_UNLOCK ( bufobj ) ; pbrelvp ( bp ) ; if ( ! LIST_EMPTY ( & bp -> b_dep ) && ( bp -> b_ioflags & BIO_ERROR ) == 0 ) buf_complete ( bp ) ; #ifdef SOFTUPDATES if ( ! LIST_EMPTY ( & bp -> b_dep ) ) softdep_move_dependencies ( bp , origbp ) ; #endif bp -> b_flags |= B_NOCACHE ; bp -> b_flags &= ~ B_CACHE ; if ( ( bp -> b_ioflags & BIO_ERROR ) != 0 ) bp -> b_flags |= B_INVAL ; bufdone ( bp ) ; BO_LOCK ( bufobj ) ; KASSERT ( ( origbp -> b_vflags & BV_BKGRDINPROG ) , ( " " ) ) ; origbp -> b_vflags &= ~ BV_BKGRDINPROG ; if ( origbp -> b_vflags & BV_BKGRDWAIT ) { origbp -> b_vflags &= ~ BV_BKGRDWAIT ; wakeup ( & origbp -> b_xflags ) ; } BO_UNLOCK ( bufobj ) ; }
Complete a background write started from bwrite.
Complete a background write started from bwrite .
/*
	 * Find the original buffer that we are writing.
	 */ /*
	 * We should mark the cylinder group buffer origbp as
	 * dirty, to not loose the failed write.
	 */ /*
	 * Process dependencies then return any unfinished ones.
	 */ /*
	 * This buffer is marked B_NOCACHE so when it is released
	 * by biodone it will be tossed.
	 */ /*
	 * Prevent brelse() from trying to keep and re-dirtying bp on
	 * errors. It causes b_bufobj dereference in
	 * bdirty()/reassignbuf(), and b_bufobj was cleared in
	 * pbrelvp() above.
	 */ /*
	 * Clear the BV_BKGRDINPROG flag in the original buffer
	 * and awaken it if it is waiting for the write to complete.
	 * If BV_BKGRDINPROG is not set in the original buffer it must
	 * have been released and re-instantiated - which is not legal.
	 */