if (vp->v_type == VREG) { int flags = PGO_CLEANIT|PGO_ALLPAGES| (sync ? PGO_SYNCIO : 0);  simple_lock(&uobj->vmobjlock); (uobj->pgops->pgo_flush)(uobj, 0, 0, flags); simple_unlock(&uobj->vmobjlock); }
vflushbuf(vp, sync)	struct vnode *vp;	int sync;{	struct uvm_object *uobj = &vp->v_uobj;	struct buf *bp, *nbp;	int s;	if (vp->v_type == VREG) {		int flags = PGO_CLEANIT|PGO_ALLPAGES| (sync ? PGO_SYNCIO : 0);		simple_lock(&uobj->vmobjlock);		(uobj->pgops->pgo_flush)(uobj, 0, 0, flags);		simple_unlock(&uobj->vmobjlock);	}loop:	s = splbio();	for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = nbp) {		nbp = bp->b_vnbufs.le_next;		if ((bp->b_flags & B_BUSY))			continue;		if ((bp->b_flags & B_DELWRI) == 0)			panic("vflushbuf: not dirty");		bremfree(bp);		bp->b_flags |= B_BUSY;		splx(s);		/*		 * Wait for I/O associated with indirect blocks to complete,		 * since there is no way to quickly wait for them below.		 */		if (bp->b_vp == vp || sync == 0)			(void) bawrite(bp);		else			(void) bwrite(bp);		goto loop;	}	if (sync == 0) {		splx(s);		return;	}	vwaitforio(vp, 0, "vflushbuf", 0);	if (vp->v_dirtyblkhd.lh_first != NULL) {		splx(s);		vprint("vflushbuf: dirty", vp);		goto loop;	}	splx(s);}