projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup: namespace 'align' macros
[lttng-tools.git]
/
src
/
common
/
index-allocator.c
diff --git
a/src/common/index-allocator.c
b/src/common/index-allocator.c
index 3de09a8310ebb26e5e5b2c90056234436573f05b..8c73218a950d5275ac70d163ace4893cb53439ea 100644
(file)
--- a/
src/common/index-allocator.c
+++ b/
src/common/index-allocator.c
@@
-5,7
+5,6
@@
*
*/
*
*/
-#include <assert.h>
#include <inttypes.h>
#include <urcu.h>
#include <inttypes.h>
#include <urcu.h>
@@
-20,6
+19,7
@@
struct lttng_index_allocator {
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;
};
struct lttng_index {
};
struct lttng_index {
@@
-40,6
+40,7
@@
struct lttng_index_allocator *lttng_index_allocator_create(
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);
@@
-49,7
+50,7
@@
end:
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(
@@
-77,6
+78,7
@@
enum lttng_index_allocator_status lttng_index_allocator_alloc(
free(index);
}
free(index);
}
+ allocator->nb_allocated_indexes++;
end:
return status;
}
end:
return status;
}
@@
-88,7
+90,7
@@
enum lttng_index_allocator_status lttng_index_allocator_release(
enum lttng_index_allocator_status status =
LTTNG_INDEX_ALLOCATOR_STATUS_OK;
enum lttng_index_allocator_status status =
LTTNG_INDEX_ALLOCATOR_STATUS_OK;
-
assert
(idx < allocator->size);
+
LTTNG_ASSERT
(idx < allocator->size);
index = zmalloc(sizeof(*index));
if (!index) {
index = zmalloc(sizeof(*index));
if (!index) {
@@
-99,6
+101,7
@@
enum lttng_index_allocator_status lttng_index_allocator_release(
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--;
end:
return status;
end:
return status;
This page took
0.024937 seconds
and
4
git commands to generate.