MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fail_point_garbage_collect

Function fail_point_garbage_collect

freebsd/kern/kern_fail.c:358–388  ·  view source on GitHub ↗

Free up any zero-ref entries in the garbage queue */

Source from the content-addressed store, hash-verified

356
357/* Free up any zero-ref entries in the garbage queue */
358static void
359fail_point_garbage_collect(void)
360{
361 struct fail_point_setting *fs_current, *fs_next;
362 struct fail_point_setting_garbage fp_ents_free_list;
363
364 /**
365 * We will transfer the entries to free to fp_ents_free_list while holding
366 * the spin mutex, then free it after we drop the lock. This avoids
367 * triggering witness due to sleepable mutexes in the memory
368 * allocator.
369 */
370 STAILQ_INIT(&fp_ents_free_list);
371
372 mtx_lock_spin(&mtx_garbage_list);
373 STAILQ_FOREACH_SAFE(fs_current, &fp_setting_garbage, fs_garbage_link,
374 fs_next) {
375 if (fs_current->fs_parent->fp_setting != fs_current &&
376 fs_current->fs_parent->fp_ref_cnt == 0) {
377 STAILQ_REMOVE(&fp_setting_garbage, fs_current,
378 fail_point_setting, fs_garbage_link);
379 STAILQ_INSERT_HEAD(&fp_ents_free_list, fs_current,
380 fs_garbage_link);
381 }
382 }
383 mtx_unlock_spin(&mtx_garbage_list);
384
385 STAILQ_FOREACH_SAFE(fs_current, &fp_ents_free_list, fs_garbage_link,
386 fs_next)
387 fail_point_setting_destroy(fs_current);
388}
389
390/* Drain out all refs from this fail point */
391static inline void

Callers 3

fail_point_destroyFunction · 0.85
fail_point_sysctlFunction · 0.85
fail_point_sysctl_statusFunction · 0.85

Calls 1

Tested by

no test coverage detected