Lines Matching refs:pool

347 	struct spdk_bit_pool *pool = NULL;  in spdk_bit_pool_create()  local
355 pool = calloc(1, sizeof(*pool)); in spdk_bit_pool_create()
356 if (pool == NULL) { in spdk_bit_pool_create()
361 pool->array = array; in spdk_bit_pool_create()
362 pool->lowest_free_bit = 0; in spdk_bit_pool_create()
363 pool->free_count = num_bits; in spdk_bit_pool_create()
365 return pool; in spdk_bit_pool_create()
371 struct spdk_bit_pool *pool = NULL; in spdk_bit_pool_create_from_array() local
373 pool = calloc(1, sizeof(*pool)); in spdk_bit_pool_create_from_array()
374 if (pool == NULL) { in spdk_bit_pool_create_from_array()
378 pool->array = array; in spdk_bit_pool_create_from_array()
379 pool->lowest_free_bit = spdk_bit_array_find_first_clear(array, 0); in spdk_bit_pool_create_from_array()
380 pool->free_count = spdk_bit_array_count_clear(array); in spdk_bit_pool_create_from_array()
382 return pool; in spdk_bit_pool_create_from_array()
388 struct spdk_bit_pool *pool; in spdk_bit_pool_free() local
394 pool = *ppool; in spdk_bit_pool_free()
396 if (pool != NULL) { in spdk_bit_pool_free()
397 spdk_bit_array_free(&pool->array); in spdk_bit_pool_free()
398 free(pool); in spdk_bit_pool_free()
405 struct spdk_bit_pool *pool; in spdk_bit_pool_resize() local
410 pool = *ppool; in spdk_bit_pool_resize()
411 rc = spdk_bit_array_resize(&pool->array, num_bits); in spdk_bit_pool_resize()
416 pool->lowest_free_bit = spdk_bit_array_find_first_clear(pool->array, 0); in spdk_bit_pool_resize()
417 pool->free_count = spdk_bit_array_count_clear(pool->array); in spdk_bit_pool_resize()
423 spdk_bit_pool_capacity(const struct spdk_bit_pool *pool) in spdk_bit_pool_capacity() argument
425 return spdk_bit_array_capacity(pool->array); in spdk_bit_pool_capacity()
429 spdk_bit_pool_is_allocated(const struct spdk_bit_pool *pool, uint32_t bit_index) in spdk_bit_pool_is_allocated() argument
431 return spdk_bit_array_get(pool->array, bit_index); in spdk_bit_pool_is_allocated()
435 spdk_bit_pool_allocate_bit(struct spdk_bit_pool *pool) in spdk_bit_pool_allocate_bit() argument
437 uint32_t bit_index = pool->lowest_free_bit; in spdk_bit_pool_allocate_bit()
443 spdk_bit_array_set(pool->array, bit_index); in spdk_bit_pool_allocate_bit()
444 pool->lowest_free_bit = spdk_bit_array_find_first_clear(pool->array, bit_index); in spdk_bit_pool_allocate_bit()
445 pool->free_count--; in spdk_bit_pool_allocate_bit()
450 spdk_bit_pool_free_bit(struct spdk_bit_pool *pool, uint32_t bit_index) in spdk_bit_pool_free_bit() argument
452 assert(spdk_bit_array_get(pool->array, bit_index) == true); in spdk_bit_pool_free_bit()
454 spdk_bit_array_clear(pool->array, bit_index); in spdk_bit_pool_free_bit()
455 if (pool->lowest_free_bit > bit_index) { in spdk_bit_pool_free_bit()
456 pool->lowest_free_bit = bit_index; in spdk_bit_pool_free_bit()
458 pool->free_count++; in spdk_bit_pool_free_bit()
462 spdk_bit_pool_count_allocated(const struct spdk_bit_pool *pool) in spdk_bit_pool_count_allocated() argument
464 return spdk_bit_array_capacity(pool->array) - pool->free_count; in spdk_bit_pool_count_allocated()
468 spdk_bit_pool_count_free(const struct spdk_bit_pool *pool) in spdk_bit_pool_count_free() argument
470 return pool->free_count; in spdk_bit_pool_count_free()
474 spdk_bit_pool_store_mask(const struct spdk_bit_pool *pool, void *mask) in spdk_bit_pool_store_mask() argument
476 spdk_bit_array_store_mask(pool->array, mask); in spdk_bit_pool_store_mask()
480 spdk_bit_pool_load_mask(struct spdk_bit_pool *pool, const void *mask) in spdk_bit_pool_load_mask() argument
482 spdk_bit_array_load_mask(pool->array, mask); in spdk_bit_pool_load_mask()
483 pool->lowest_free_bit = spdk_bit_array_find_first_clear(pool->array, 0); in spdk_bit_pool_load_mask()
484 pool->free_count = spdk_bit_array_count_clear(pool->array); in spdk_bit_pool_load_mask()
488 spdk_bit_pool_free_all_bits(struct spdk_bit_pool *pool) in spdk_bit_pool_free_all_bits() argument
490 spdk_bit_array_clear_mask(pool->array); in spdk_bit_pool_free_all_bits()
491 pool->lowest_free_bit = 0; in spdk_bit_pool_free_all_bits()
492 pool->free_count = spdk_bit_array_capacity(pool->array); in spdk_bit_pool_free_all_bits()