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

Function vdev_initialize_cb

freebsd/contrib/openzfs/module/zfs/vdev_initialize.c:162–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162static void
163vdev_initialize_cb(zio_t *zio)
164{
165 vdev_t *vd = zio->io_vd;
166 mutex_enter(&vd->vdev_initialize_io_lock);
167 if (zio->io_error == ENXIO && !vdev_writeable(vd)) {
168 /*
169 * The I/O failed because the vdev was unavailable; roll the
170 * last offset back. (This works because spa_sync waits on
171 * spa_txg_zio before it runs sync tasks.)
172 */
173 uint64_t *off =
174 &vd->vdev_initialize_offset[zio->io_txg & TXG_MASK];
175 *off = MIN(*off, zio->io_offset);
176 } else {
177 /*
178 * Since initializing is best-effort, we ignore I/O errors and
179 * rely on vdev_probe to determine if the errors are more
180 * critical.
181 */
182 if (zio->io_error != 0)
183 vd->vdev_stat.vs_initialize_errors++;
184
185 vd->vdev_initialize_bytes_done += zio->io_orig_size;
186 }
187 ASSERT3U(vd->vdev_initialize_inflight, >, 0);
188 vd->vdev_initialize_inflight--;
189 cv_broadcast(&vd->vdev_initialize_io_cv);
190 mutex_exit(&vd->vdev_initialize_io_lock);
191
192 spa_config_exit(vd->vdev_spa, SCL_STATE_ALL, vd);
193}
194
195/* Takes care of physical writing and limiting # of concurrent ZIOs. */
196static int

Callers

nothing calls this directly

Calls 5

mutex_enterFunction · 0.85
vdev_writeableFunction · 0.85
cv_broadcastFunction · 0.85
mutex_exitFunction · 0.85
spa_config_exitFunction · 0.85

Tested by

no test coverage detected