* The zio_done_func_t done callback for each manual TRIM issued. It is * responsible for updating the TRIM stats, reissuing failed TRIM I/Os, * and limiting the number of in flight TRIM I/Os. */
| 362 | * and limiting the number of in flight TRIM I/Os. |
| 363 | */ |
| 364 | static void |
| 365 | vdev_trim_cb(zio_t *zio) |
| 366 | { |
| 367 | vdev_t *vd = zio->io_vd; |
| 368 | |
| 369 | mutex_enter(&vd->vdev_trim_io_lock); |
| 370 | if (zio->io_error == ENXIO && !vdev_writeable(vd)) { |
| 371 | /* |
| 372 | * The I/O failed because the vdev was unavailable; roll the |
| 373 | * last offset back. (This works because spa_sync waits on |
| 374 | * spa_txg_zio before it runs sync tasks.) |
| 375 | */ |
| 376 | uint64_t *offset = |
| 377 | &vd->vdev_trim_offset[zio->io_txg & TXG_MASK]; |
| 378 | *offset = MIN(*offset, zio->io_offset); |
| 379 | } else { |
| 380 | if (zio->io_error != 0) { |
| 381 | vd->vdev_stat.vs_trim_errors++; |
| 382 | spa_iostats_trim_add(vd->vdev_spa, TRIM_TYPE_MANUAL, |
| 383 | 0, 0, 0, 0, 1, zio->io_orig_size); |
| 384 | } else { |
| 385 | spa_iostats_trim_add(vd->vdev_spa, TRIM_TYPE_MANUAL, |
| 386 | 1, zio->io_orig_size, 0, 0, 0, 0); |
| 387 | } |
| 388 | |
| 389 | vd->vdev_trim_bytes_done += zio->io_orig_size; |
| 390 | } |
| 391 | |
| 392 | ASSERT3U(vd->vdev_trim_inflight[TRIM_TYPE_MANUAL], >, 0); |
| 393 | vd->vdev_trim_inflight[TRIM_TYPE_MANUAL]--; |
| 394 | cv_broadcast(&vd->vdev_trim_io_cv); |
| 395 | mutex_exit(&vd->vdev_trim_io_lock); |
| 396 | |
| 397 | spa_config_exit(vd->vdev_spa, SCL_STATE_ALL, vd); |
| 398 | } |
| 399 | |
| 400 | /* |
| 401 | * The zio_done_func_t done callback for each automatic TRIM issued. It |
nothing calls this directly
no test coverage detected