FreeBSD/sys/kern/subr_blist.c
/*
 * BLST_LEAF_FILL() -	allocate specific blocks in leaf bitmap
 *
 *	This routine allocates all blocks in the specified range
 *	regardless of any existing allocations in that range.  Returns
 *	the number of blocks allocated by the call.
 */
allocate specific blocks in leaf bitmap
This routine allocates all blocks in the specified range
regardless of any existing allocations in that range.  Returns
the number of blocks allocated by the call.
allocate specific blocks in leaf bitmap This routine allocates all blocks in the specified range regardless of any existing allocations in that range . Returns the number of blocks allocated by the call .
static int
blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count)
{
	int n = blk & (BLIST_BMAP_RADIX - 1);
	int nblks;
	u_daddr_t mask, bitmap;
	mask = ((u_daddr_t)-1 << n) &
	    ((u_daddr_t)-1 >> (BLIST_BMAP_RADIX - count - n));
	bitmap = scan->u.bmu_bitmap & mask;
	for (nblks = 0; bitmap != 0; nblks++)
		bitmap &= bitmap - 1;
	scan->u.bmu_bitmap &= ~mask;
	return nblks;
}
static int blst_leaf_fill ( blmeta_t * scan , daddr_t blk , int count ) { int n = blk & ( BLIST_BMAP_RADIX - 1 ) ; int nblks ; u_daddr_t mask , bitmap ; mask = ( ( u_daddr_t ) - 1 << n ) & ( ( u_daddr_t ) - 1 >> ( BLIST_BMAP_RADIX - count - n ) ) ; bitmap = scan -> u . bmu_bitmap & mask ; for ( nblks = 0 ; bitmap != 0 ; nblks ++ ) bitmap &= bitmap - 1 ; scan -> u . bmu_bitmap &= ~ mask ; return nblks ; }
BLST_LEAF_FILL() -   allocate specific blocks in leaf bitmap
      This routine allocates all blocks in the specified range
      regardless of any existing allocations in that range.
BLST_LEAF_FILL () - allocate specific blocks in leaf bitmap This routine allocates all blocks in the specified range regardless of any existing allocations in that range .
/* Count the number of blocks we're about to allocate */