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

Function vdev_trim_stop

freebsd/contrib/openzfs/module/zfs/vdev_trim.c:1026–1050  ·  view source on GitHub ↗

* Stop trimming a device, with the resultant trimming state being tgt_state. * For blocking behavior pass NULL for vd_list. Otherwise, when a list_t is * provided the stopping vdev is inserted in to the list. Callers are then * required to call vdev_trim_stop_wait() to block for all the trim threads * to exit. The caller must hold vdev_trim_lock and must not be writing to * the spa config,

Source from the content-addressed store, hash-verified

1024 * reader before exiting.
1025 */
1026void
1027vdev_trim_stop(vdev_t *vd, vdev_trim_state_t tgt_state, list_t *vd_list)
1028{
1029 ASSERT(!spa_config_held(vd->vdev_spa, SCL_CONFIG|SCL_STATE, RW_WRITER));
1030 ASSERT(MUTEX_HELD(&vd->vdev_trim_lock));
1031 ASSERT(vd->vdev_ops->vdev_op_leaf);
1032 ASSERT(vdev_is_concrete(vd));
1033
1034 /*
1035 * Allow cancel requests to proceed even if the trim thread has
1036 * stopped.
1037 */
1038 if (vd->vdev_trim_thread == NULL && tgt_state != VDEV_TRIM_CANCELED)
1039 return;
1040
1041 vdev_trim_change_state(vd, tgt_state, 0, 0, 0);
1042 vd->vdev_trim_exit_wanted = B_TRUE;
1043
1044 if (vd_list == NULL) {
1045 vdev_trim_stop_wait_impl(vd);
1046 } else {
1047 ASSERT(MUTEX_HELD(&spa_namespace_lock));
1048 list_insert_tail(vd_list, vd);
1049 }
1050}
1051
1052/*
1053 * Requests that all listed vdevs stop trimming.

Callers 5

spa_vdev_config_exitFunction · 0.85
vdev_trim_stop_all_implFunction · 0.85
spa_vdev_trim_implFunction · 0.85
spa_vdev_split_mirrorFunction · 0.85
spa_vdev_removeFunction · 0.85

Calls 5

spa_config_heldFunction · 0.85
vdev_is_concreteFunction · 0.85
vdev_trim_change_stateFunction · 0.85
vdev_trim_stop_wait_implFunction · 0.85
list_insert_tailFunction · 0.50

Tested by

no test coverage detected