@@ -133,6 +133,8 @@ struct critnib_leaf {
133133 * to the 'c->deleted_leaf' list when the reference count drops to 0.
134134 */
135135 uint8_t pending_deleted_leaf ;
136+ // the 'next' pointer in the 'c->deleted_leaf' list
137+ void * next ;
136138 uint64_t ref_count ;
137139};
138140
@@ -253,7 +255,7 @@ void critnib_delete(struct critnib *c) {
253255 }
254256
255257 for (struct critnib_leaf * k = c -> deleted_leaf ; k ;) {
256- struct critnib_leaf * kk = k -> value ;
258+ struct critnib_leaf * kk = k -> next ;
257259 umf_ba_global_free (k );
258260 k = kk ;
259261 }
@@ -317,9 +319,9 @@ static void add_to_deleted_leaf_list(struct critnib *__restrict c,
317319
318320 utils_atomic_load_acquire_ptr ((void * * )& c -> deleted_leaf ,
319321 (void * * )& deleted_leaf );
320- utils_atomic_store_release_ptr (& k -> value , deleted_leaf );
322+ utils_atomic_store_release_ptr (& k -> next , deleted_leaf );
321323 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 )) {
323325 ;
324326 }
325327}
@@ -368,8 +370,8 @@ static struct critnib_leaf *alloc_leaf(struct critnib *__restrict c) {
368370 if (!k ) {
369371 return umf_ba_global_aligned_alloc (sizeof (struct critnib_leaf ), 8 );
370372 }
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 ));
373375
374376 utils_annotate_memory_new (k , sizeof (* k ));
375377
0 commit comments