@@ -133,6 +133,8 @@ struct critnib_leaf {
133
133
* to the 'c->deleted_leaf' list when the reference count drops to 0.
134
134
*/
135
135
uint8_t pending_deleted_leaf ;
136
+ // the 'next' pointer in the 'c->deleted_leaf' list
137
+ void * next ;
136
138
uint64_t ref_count ;
137
139
};
138
140
@@ -253,7 +255,7 @@ void critnib_delete(struct critnib *c) {
253
255
}
254
256
255
257
for (struct critnib_leaf * k = c -> deleted_leaf ; k ;) {
256
- struct critnib_leaf * kk = k -> value ;
258
+ struct critnib_leaf * kk = k -> next ;
257
259
umf_ba_global_free (k );
258
260
k = kk ;
259
261
}
@@ -317,9 +319,9 @@ static void add_to_deleted_leaf_list(struct critnib *__restrict c,
317
319
318
320
utils_atomic_load_acquire_ptr ((void * * )& c -> deleted_leaf ,
319
321
(void * * )& deleted_leaf );
320
- utils_atomic_store_release_ptr (& k -> value , deleted_leaf );
322
+ utils_atomic_store_release_ptr (& k -> next , deleted_leaf );
321
323
while (!utils_compare_exchange_u64 ((uint64_t * )& c -> deleted_leaf ,
322
- (uint64_t * )& k -> value , (uint64_t * )& k )) {
324
+ (uint64_t * )& k -> next , (uint64_t * )& k )) {
323
325
;
324
326
}
325
327
}
@@ -368,8 +370,8 @@ static struct critnib_leaf *alloc_leaf(struct critnib *__restrict c) {
368
370
if (!k ) {
369
371
return umf_ba_global_aligned_alloc (sizeof (struct critnib_leaf ), 8 );
370
372
}
371
- } while (!utils_compare_exchange_u64 (
372
- ( uint64_t * ) & c -> deleted_leaf , (uint64_t * )& k , (uint64_t * )& k -> value ));
373
+ } while (!utils_compare_exchange_u64 (( uint64_t * ) & c -> deleted_leaf ,
374
+ (uint64_t * )& k , (uint64_t * )& k -> next ));
373
375
374
376
utils_annotate_memory_new (k , sizeof (* k ));
375
377
0 commit comments