FreeBSD/sys/kern/vfs_bio.c
/*
 *	bufspace_reserve:
 *
 *	Reserve bufspace before calling allocbuf().  metadata has a
 *	different space limit than data.
 */
Reserve bufspace before calling allocbuf().  metadata has a
different space limit than data.
Reserve bufspace before calling allocbuf () . metadata has a different space limit than data .
static int
bufspace_reserve(int size, bool metadata)
{
	long limit;
	long space;
	if (metadata)
		limit = maxbufspace;
	else
		limit = hibufspace;
	do {
		space = bufspace;
		if (space + size > limit)
			return (ENOSPC);
	} while (atomic_cmpset_long(&bufspace, space, space + size) == 0);
	if (space < bufspacethresh && space + size >= bufspacethresh)
		bufspace_daemonwakeup();
	return (0);
}
static int bufspace_reserve ( int size , bool metadata ) { long limit ; long space ; if ( metadata ) limit = maxbufspace ; else limit = hibufspace ; do { space = bufspace ; if ( space + size > limit ) return ( ENOSPC ) ; } while ( atomic_cmpset_long ( & bufspace , space , space + size ) == 0 ) ; if ( space < bufspacethresh && space + size >= bufspacethresh ) bufspace_daemonwakeup ( ) ; return ( 0 ) ; }
bufspace_reserve:
      Reserve bufspace before calling allocbuf().
bufspace_reserve : Reserve bufspace before calling allocbuf () .
/* Wake up the daemon on the transition. */