+
+/*
+ * XXX
+ * This routine flushes buffers out of the B_LOCKED queue when LFS has too
+ * many locked down. Eventually the pageout daemon will simply call LFS
+ * when pages need to be reclaimed.
+ */
+void
+lfs_flush()
+{
+ register struct mount *mp;
+ struct mount *omp;
+
+ /* 800K in a 4K file system. */
+ if (locked_queue_count < 200)
+ return;
+ mp = rootfs;
+ do {
+ /*
+ * The lock check below is to avoid races with mount
+ * and unmount.
+ */
+ if (mp->mnt_stat.f_type == MOUNT_LFS &&
+ (mp->mnt_flag & (MNT_MLOCK|MNT_RDONLY|MNT_MPBUSY)) == 0 &&
+ !vfs_busy(mp)) {
+ lfs_segwrite(mp, 0);
+ omp = mp;
+ mp = mp->mnt_next;
+ vfs_unbusy(omp);
+ } else
+ mp = mp->mnt_next;
+ } while (mp != rootfs);
+ /* Not exact, but it doesn't matter. */
+ locked_queue_count = 0;
+}