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

Function vdev_trim_stop_all

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

* Convenience function to stop trimming of a vdev tree and set all trim * thread pointers to NULL. */

Source from the content-addressed store, hash-verified

1074 * thread pointers to NULL.
1075 */
1076void
1077vdev_trim_stop_all(vdev_t *vd, vdev_trim_state_t tgt_state)
1078{
1079 spa_t *spa = vd->vdev_spa;
1080 list_t vd_list;
1081 vdev_t *vd_l2cache;
1082
1083 ASSERT(MUTEX_HELD(&spa_namespace_lock));
1084
1085 list_create(&vd_list, sizeof (vdev_t),
1086 offsetof(vdev_t, vdev_trim_node));
1087
1088 vdev_trim_stop_all_impl(vd, tgt_state, &vd_list);
1089
1090 /*
1091 * Iterate over cache devices and request stop trimming the
1092 * whole device in case we export the pool or remove the cache
1093 * device prematurely.
1094 */
1095 for (int i = 0; i < spa->spa_l2cache.sav_count; i++) {
1096 vd_l2cache = spa->spa_l2cache.sav_vdevs[i];
1097 vdev_trim_stop_all_impl(vd_l2cache, tgt_state, &vd_list);
1098 }
1099
1100 vdev_trim_stop_wait(spa, &vd_list);
1101
1102 if (vd->vdev_spa->spa_sync_on) {
1103 /* Make sure that our state has been synced to disk */
1104 txg_wait_synced(spa_get_dsl(vd->vdev_spa), 0);
1105 }
1106
1107 list_destroy(&vd_list);
1108}
1109
1110/*
1111 * Conditionally restarts a manual TRIM given its on-disk state.

Callers 4

spa_unloadFunction · 0.85
spa_export_commonFunction · 0.85
spa_vdev_remove_logFunction · 0.85
spa_vdev_remove_topFunction · 0.85

Calls 6

vdev_trim_stop_all_implFunction · 0.85
vdev_trim_stop_waitFunction · 0.85
txg_wait_syncedFunction · 0.85
spa_get_dslFunction · 0.85
list_createFunction · 0.50
list_destroyFunction · 0.50

Tested by

no test coverage detected