| 381 | } |
| 382 | |
| 383 | void |
| 384 | epoch_free(epoch_t epoch) |
| 385 | { |
| 386 | #ifdef INVARIANTS |
| 387 | int cpu; |
| 388 | #endif |
| 389 | |
| 390 | EPOCH_LOCK(); |
| 391 | |
| 392 | MPASS(epoch->e_in_use != 0); |
| 393 | |
| 394 | epoch_drain_callbacks(epoch); |
| 395 | |
| 396 | atomic_store_rel_int(&epoch->e_in_use, 0); |
| 397 | /* |
| 398 | * Make sure the epoch_call_task() function see e_in_use equal |
| 399 | * to zero, by calling epoch_wait() on the global_epoch: |
| 400 | */ |
| 401 | epoch_wait(global_epoch); |
| 402 | #ifdef INVARIANTS |
| 403 | CPU_FOREACH(cpu) { |
| 404 | epoch_record_t er; |
| 405 | |
| 406 | er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu); |
| 407 | |
| 408 | /* |
| 409 | * Sanity check: none of the records should be in use anymore. |
| 410 | * We drained callbacks above and freeing the pcpu records is |
| 411 | * imminent. |
| 412 | */ |
| 413 | MPASS(er->er_td == NULL); |
| 414 | MPASS(TAILQ_EMPTY(&er->er_tdlist)); |
| 415 | } |
| 416 | #endif |
| 417 | uma_zfree_pcpu(pcpu_zone_record, epoch->e_pcpu_record); |
| 418 | mtx_destroy(&epoch->e_drain_mtx); |
| 419 | sx_destroy(&epoch->e_drain_sx); |
| 420 | memset(epoch, 0, sizeof(*epoch)); |
| 421 | |
| 422 | EPOCH_UNLOCK(); |
| 423 | } |
| 424 | |
| 425 | static epoch_record_t |
| 426 | epoch_currecord(epoch_t epoch) |
nothing calls this directly
no test coverage detected