FreeBSD/sys/kern/vfs_bio.c
/*
 *	bwillwrite:
 *
 *	Called prior to the locking of any vnodes when we are expecting to
 *	write.  We do not want to starve the buffer cache with too many
 *	dirty buffers so we block here.  By blocking prior to the locking
 *	of any vnodes we attempt to avoid the situation where a locked vnode
 *	prevents the various system daemons from flushing related buffers.
 */
Called prior to the locking of any vnodes when we are expecting to
write.  We do not want to starve the buffer cache with too many
dirty buffers so we block here.  By blocking prior to the locking
of any vnodes we attempt to avoid the situation where a locked vnode
prevents the various system daemons from flushing related buffers.
Called prior to the locking of any vnodes when we are expecting to write . We do not want to starve the buffer cache with too many dirty buffers so we block here . By blocking prior to the locking of any vnodes we attempt to avoid the situation where a locked vnode prevents the various system daemons from flushing related buffers .
void
bwillwrite(void)
{
	if (numdirtybuffers >= hidirtybuffers) {
		mtx_lock(&bdirtylock);
		while (numdirtybuffers >= hidirtybuffers) {
			bdirtywait = 1;
			msleep(&bdirtywait, &bdirtylock, (PRIBIO + 4),
			    "flswai", 0);
		}
		mtx_unlock(&bdirtylock);
	}
}
void bwillwrite ( void ) { if ( numdirtybuffers >= hidirtybuffers ) { mtx_lock ( & bdirtylock ) ; while ( numdirtybuffers >= hidirtybuffers ) { bdirtywait = 1 ; msleep ( & bdirtywait , & bdirtylock , ( PRIBIO + 4 ) , " " , 0 ) ; } mtx_unlock ( & bdirtylock ) ; } }
bwillwrite:
      Called prior to the locking of any vnodes when we are expecting to
      write.
bwillwrite : Called prior to the locking of any vnodes when we are expecting to write .