+
+/*
+ * Invalidate in core blocks belonging to closed or umounted filesystem
+ *
+ * This is not nicely done at all - the buffer ought to be removed from the
+ * hash chains & have its dev/blkno fields clobbered, but unfortunately we
+ * can't do that here, as it is quite possible that the block is still
+ * being used for i/o. Eventually, all disc drivers should be forced to
+ * have a close routine, which ought ensure that the queue is empty, then
+ * properly flush the queues. Until that happy day, this suffices for
+ * correctness. ... kre
+ */
+binval(dev)
+dev_t dev;
+{
+ register struct buf *bp;
+ register struct bufhd *hp;
+#define dp ((struct buf *)hp)
+
+ for (hp = bufhash; hp < &bufhash[BUFHSZ]; hp++)
+ for (bp = dp->b_forw; bp != dp; bp = bp->b_forw)
+ if (bp->b_dev == dev)
+ bp->b_flags |= B_INVAL;
+}