struct cds_list_head unused_list;
uint64_t size;
uint64_t position;
+ uint64_t nb_allocated_indexes;
};
struct lttng_index {
allocator->size = index_count;
allocator->position = 0;
+ allocator->nb_allocated_indexes = 0;
CDS_INIT_LIST_HEAD(&allocator->unused_list);
uint64_t lttng_index_allocator_get_index_count(struct lttng_index_allocator *allocator)
{
- return allocator->size;
+ return allocator->nb_allocated_indexes;
}
enum lttng_index_allocator_status lttng_index_allocator_alloc(
free(index);
}
+ allocator->nb_allocated_indexes++;
end:
return status;
}
index->index = idx;
cds_list_add_tail(&index->head, &allocator->unused_list);
+ allocator->nb_allocated_indexes--;
end:
return status;