sys/ufs/lfs/lfs_bio.c
/*
 * 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.  Note, we have one static count of locked
 * buffers, so we can't have more than a single file system.  To make this
 * work for multiple file systems, put the count into the mount structure.
 */
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.  Note, we have one static count of locked
buffers, so we can't have more than a single file system.  To make this
work for multiple file systems, put the count into the mount structure.
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 . Note we have one static count of locked buffers so we can ' t have more than a single file system . To make this work for multiple file systems put the count into the mount structure .
void
lfs_flush()
{
	register struct mount *mp, *nmp;
	struct proc *p = curproc;	
#ifdef DOSTATS
	++lfs_stats.write_exceeded;
#endif
	if (lfs_writing)
		return;
	lfs_writing = 1;
	simple_lock(&mountlist_slock);
	for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) {
		if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) {
			nmp = mp->mnt_list.cqe_next;
			continue;
		}
		if (mp->mnt_stat.f_type == lfs_mount_type &&
		    (mp->mnt_flag & MNT_RDONLY) == 0 &&
		    !((((struct ufsmount *)mp->mnt_data))->ufsmount_u.lfs)->lfs_dirops ) {
#ifdef DOSTATS
			++lfs_stats.flush_invoked;
#endif
			lfs_segwrite(mp, 0);
		}
		simple_lock(&mountlist_slock);
		nmp = mp->mnt_list.cqe_next;
		vfs_unbusy(mp, p);
	}
	simple_unlock(&mountlist_slock);
	lfs_writing = 0;
}
void lfs_flush ( ) { register struct mount * mp , * nmp ; struct proc * p = curproc ; #ifdef DOSTATS ++ lfs_stats . write_exceeded ; #endif if ( lfs_writing ) return ; lfs_writing = 1 ; simple_lock ( & mountlist_slock ) ; for ( mp = mountlist . cqh_first ; mp != ( void * ) & mountlist ; mp = nmp ) { if ( vfs_busy ( mp , LK_NOWAIT , & mountlist_slock , p ) ) { nmp = mp -> mnt_list . cqe_next ; continue ; } if ( mp -> mnt_stat . f_type == lfs_mount_type && ( mp -> mnt_flag & MNT_RDONLY ) == 0 && ! ( ( ( ( struct ufsmount * ) mp -> mnt_data ) ) -> ufsmount_u . lfs ) -> lfs_dirops ) { #ifdef DOSTATS ++ lfs_stats . flush_invoked ; #endif lfs_segwrite ( mp , 0 ) ; } simple_lock ( & mountlist_slock ) ; nmp = mp -> mnt_list . cqe_next ; vfs_unbusy ( mp , p ) ; } simple_unlock ( & mountlist_slock ) ; lfs_writing = 0 ; }
XXX
 This routine flushes buffers out of the B_LOCKED queue when LFS has too
 many locked down.
XXX This routine flushes buffers out of the B_LOCKED queue when LFS has too many locked down .
/* XXX */ /*
			 * We set the queue to 0 here because we are about to
			 * write all the dirty buffers we have.  If more come
			 * in while we're writing the segment, they may not
			 * get written, so we want the count to reflect these
			 * new writes after the segwrite completes.
			 */