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

Function zio_wait

freebsd/contrib/openzfs/module/zfs/zio.c:2211–2255  ·  view source on GitHub ↗

* ========================================================================== * Initiate I/O, either sync or async * ========================================================================== */

Source from the content-addressed store, hash-verified

2209 * ==========================================================================
2210 */
2211int
2212zio_wait(zio_t *zio)
2213{
2214 /*
2215 * Some routines, like zio_free_sync(), may return a NULL zio
2216 * to avoid the performance overhead of creating and then destroying
2217 * an unneeded zio. For the callers' simplicity, we accept a NULL
2218 * zio and ignore it.
2219 */
2220 if (zio == NULL)
2221 return (0);
2222
2223 long timeout = MSEC_TO_TICK(zfs_deadman_ziotime_ms);
2224 int error;
2225
2226 ASSERT3S(zio->io_stage, ==, ZIO_STAGE_OPEN);
2227 ASSERT3P(zio->io_executor, ==, NULL);
2228
2229 zio->io_waiter = curthread;
2230 ASSERT0(zio->io_queued_timestamp);
2231 zio->io_queued_timestamp = gethrtime();
2232
2233 __zio_execute(zio);
2234
2235 mutex_enter(&zio->io_lock);
2236 while (zio->io_executor != NULL) {
2237 error = cv_timedwait_io(&zio->io_cv, &zio->io_lock,
2238 ddi_get_lbolt() + timeout);
2239
2240 if (zfs_deadman_enabled && error == -1 &&
2241 gethrtime() - zio->io_queued_timestamp >
2242 spa_deadman_ziotime(zio->io_spa)) {
2243 mutex_exit(&zio->io_lock);
2244 timeout = MSEC_TO_TICK(zfs_deadman_checktime_ms);
2245 zio_deadman(zio, FTAG);
2246 mutex_enter(&zio->io_lock);
2247 }
2248 }
2249 mutex_exit(&zio->io_lock);
2250
2251 error = zio->io_error;
2252 zio_destroy(zio);
2253
2254 return (error);
2255}
2256
2257void
2258zio_nowait(zio_t *zio)

Callers 15

vdev_label_write_pad2Function · 0.85
dmu_tx_count_writeFunction · 0.85
dmu_tx_hold_free_implFunction · 0.85
mmp_threadFunction · 0.85
dsl_dataset_zero_zilFunction · 0.85
vdev_openFunction · 0.85
arc_readFunction · 0.85
l2arc_write_buffersFunction · 0.85
l2arc_dev_hdr_readFunction · 0.85
l2arc_log_blk_readFunction · 0.85

Calls 7

__zio_executeFunction · 0.85
mutex_enterFunction · 0.85
spa_deadman_ziotimeFunction · 0.85
mutex_exitFunction · 0.85
zio_deadmanFunction · 0.85
zio_destroyFunction · 0.85
gethrtimeFunction · 0.50

Tested by

no test coverage detected