FreeBSD/sys/kern/vfs_bio.c
/*
 *	bufspace_adjust:
 *
 *	Adjust the reported bufspace for a KVA managed buffer, possibly
 * 	waking any waiters.
 */
Adjust the reported bufspace for a KVA managed buffer, possibly
waking any waiters.
Adjust the reported bufspace for a KVA managed buffer possibly waking any waiters .
static void
bufspace_adjust(struct buf *bp, int bufsize)
{
	long space;
	int diff;
	KASSERT((bp->b_flags & B_MALLOC) == 0,
	    ("bufspace_adjust: malloc buf %p", bp));
	diff = bufsize - bp->b_bufsize;
	if (diff < 0) {
		atomic_subtract_long(&bufspace, -diff);
		bufspace_wakeup();
	} else {
		space = atomic_fetchadd_long(&bufspace, diff);
		if (space < bufspacethresh && space + diff >= bufspacethresh)
			bufspace_daemonwakeup();
	}
	bp->b_bufsize = bufsize;
}
static void bufspace_adjust ( struct buf * bp , int bufsize ) { long space ; int diff ; KASSERT ( ( bp -> b_flags & B_MALLOC ) == 0 , ( " " , bp ) ) ; diff = bufsize - bp -> b_bufsize ; if ( diff < 0 ) { atomic_subtract_long ( & bufspace , - diff ) ; bufspace_wakeup ( ) ; } else { space = atomic_fetchadd_long ( & bufspace , diff ) ; if ( space < bufspacethresh && space + diff >= bufspacethresh ) bufspace_daemonwakeup ( ) ; } bp -> b_bufsize = bufsize ; }
bufspace_adjust:
      Adjust the reported bufspace for a KVA managed buffer, possibly
      waking any waiters.
bufspace_adjust : Adjust the reported bufspace for a KVA managed buffer possibly waking any waiters .
/* Wake up the daemon on the transition. */