+ if ((flags & B_SYNC) == 0)
+ return;
+ s = splbio();
+ while (vp->v_numoutput) {
+ vp->v_flag |= VBWAIT;
+ sleep((caddr_t)&vp->v_numoutput, PRIBIO + 1);
+ }
+ splx(s);
+ if (vp->v_dirtyblkhd) {
+ vprint("vflushbuf: dirty", vp);
+ goto loop;
+ }
+}
+
+/*
+ * Invalidate in core blocks belonging to closed or umounted filesystem
+ *
+ * Go through the list of vnodes associated with the file system;
+ * for each vnode invalidate any buffers that it holds. Normally
+ * this routine is preceeded by a bflush call, so that on a quiescent
+ * filesystem there will be no dirty buffers when we are done. Binval
+ * returns the count of dirty buffers when it is finished.
+ */
+mntinvalbuf(mountp)
+ struct mount *mountp;
+{
+ register struct vnode *vp;
+ int dirty = 0;
+
+ if ((mountp->mnt_flag & MNT_MPBUSY) == 0)
+ panic("mntinvalbuf: not busy");
+loop:
+ for (vp = mountp->mnt_mounth; vp; vp = vp->v_mountf) {
+ if (vget(vp))
+ goto loop;
+ dirty += vinvalbuf(vp, 1);
+ vput(vp);
+ if (vp->v_mount != mountp)
+ goto loop;
+ }
+ return (dirty);