FreeBSD/sys/kern/subr_blist.c
/*
 * blist_resize() -	resize an existing radix tree to handle the
 *			specified number of blocks.  This will reallocate
 *			the tree and transfer the previous bitmap to the new
 *			one.  When extending the tree you can specify whether
 *			the new blocks are to left allocated or freed.
 */
resize an existing radix tree to handle the
specified number of blocks.  This will reallocate
the tree and transfer the previous bitmap to the new
one.  When extending the tree you can specify whether
the new blocks are to left allocated or freed.
resize an existing radix tree to handle the specified number of blocks . This will reallocate the tree and transfer the previous bitmap to the new one . When extending the tree you can specify whether the new blocks are to left allocated or freed .
void
blist_resize(blist_t *pbl, daddr_t count, int freenew, int flags)
{
    blist_t newbl = blist_create(count, flags);
    blist_t save = *pbl;
    *pbl = newbl;
    if (count > save->bl_blocks)
	    count = save->bl_blocks;
    blst_copy(save->bl_root, 0, save->bl_radix, save->bl_skip, newbl, count);
    if (freenew && count < newbl->bl_blocks) {
	    blist_free(newbl, count, newbl->bl_blocks - count);
    }
    blist_destroy(save);
}
void blist_resize ( blist_t * pbl , daddr_t count , int freenew , int flags ) { blist_t newbl = blist_create ( count , flags ) ; blist_t save = * pbl ; * pbl = newbl ; if ( count > save -> bl_blocks ) count = save -> bl_blocks ; blst_copy ( save -> bl_root , 0 , save -> bl_radix , save -> bl_skip , newbl , count ) ; if ( freenew && count < newbl -> bl_blocks ) { blist_free ( newbl , count , newbl -> bl_blocks - count ) ; } blist_destroy ( save ) ; }
blist_resize() -     resize an existing radix tree to handle the
                      specified number of blocks.
blist_resize () - resize an existing radix tree to handle the specified number of blocks .
/*
     * If resizing upwards, should we free the new space or not?
     */