The lttng_index_allocator_get_index_count() should return the number of
allocated indexes. Right now it returns the maximum number of indexes.
I witnessed the following message when running testing the event
notifier error counter feature:
Warning: Destroying index allocator with 4096 slot indexes still in use
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ibbcb3f128553df0a4118901ef85ae6fe17ebcecf
struct cds_list_head unused_list;
uint64_t size;
uint64_t position;
struct cds_list_head unused_list;
uint64_t size;
uint64_t position;
+ uint64_t nb_allocated_indexes;
allocator->size = index_count;
allocator->position = 0;
allocator->size = index_count;
allocator->position = 0;
+ allocator->nb_allocated_indexes = 0;
CDS_INIT_LIST_HEAD(&allocator->unused_list);
CDS_INIT_LIST_HEAD(&allocator->unused_list);
uint64_t lttng_index_allocator_get_index_count(struct lttng_index_allocator *allocator)
{
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(
}
enum lttng_index_allocator_status lttng_index_allocator_alloc(
+ allocator->nb_allocated_indexes++;
index->index = idx;
cds_list_add_tail(&index->head, &allocator->unused_list);
index->index = idx;
cds_list_add_tail(&index->head, &allocator->unused_list);
+ allocator->nb_allocated_indexes--;