5319
5320 static void *
5321 ztest_deadman_thread(void *arg)
5322 {
5323 ztest_shared_t *zs = arg;
5324 spa_t *spa = ztest_spa;
5325 hrtime_t delta, total = 0;
5326
5327 for (;;) {
5328 delta = zs->zs_thread_stop - zs->zs_thread_start +
5329 MSEC2NSEC(zfs_deadman_synctime_ms);
5330
5331 (void) poll(NULL, 0, (int)NSEC2MSEC(delta));
5332
5333 /*
5334 * If the pool is suspended then fail immediately. Otherwise,
5335 * check to see if the pool is making any progress. If
5336 * vdev_deadman() discovers that there hasn't been any recent
5337 * I/Os then it will end up aborting the tests.
5338 */
5339 if (spa_suspended(spa)) {
5340 fatal(0, "aborting test after %llu seconds because "
5341 "pool has transitioned to a suspended state.",
5342 zfs_deadman_synctime_ms / 1000);
5343 return (NULL);
5344 }
5345 vdev_deadman(spa->spa_root_vdev);
5346
5347 total += zfs_deadman_synctime_ms/1000;
5348 (void) printf("ztest has been running for %lld seconds\n",
5349 total);
5350 }
5351 }
5352
5353 static void
5354 ztest_execute(int test, ztest_info_t *zi, uint64_t id)
5355 {
5356 ztest_ds_t *zd = &ztest_ds[id % ztest_opts.zo_datasets];
5357 ztest_shared_callstate_t *zc = ZTEST_GET_SHARED_CALLSTATE(test);
5358 hrtime_t functime = gethrtime();
5359
|
5319
5320 static void *
5321 ztest_deadman_thread(void *arg)
5322 {
5323 ztest_shared_t *zs = arg;
5324 spa_t *spa = ztest_spa;
5325 hrtime_t delta, total = 0;
5326
5327 for (;;) {
5328 delta = zs->zs_thread_stop - zs->zs_thread_start +
5329 MSEC2NSEC(zfs_deadman_synctime_ms);
5330
5331 (void) poll(NULL, 0, (int)NSEC2MSEC(delta));
5332
5333 /*
5334 * If the pool is suspended then fail immediately. Otherwise,
5335 * check to see if the pool is making any progress. If
5336 * vdev_deadman() discovers that there hasn't been any recent
5337 * I/Os then it will end up aborting the tests.
5338 */
5339 if (spa_suspended(spa) || spa->spa_root_vdev == NULL) {
5340 fatal(0, "aborting test after %llu seconds because "
5341 "pool has transitioned to a suspended state.",
5342 zfs_deadman_synctime_ms / 1000);
5343 return (NULL);
5344 }
5345 vdev_deadman(spa->spa_root_vdev);
5346
5347 total += zfs_deadman_synctime_ms/1000;
5348 (void) printf("ztest has been running for %lld seconds\n",
5349 total);
5350 }
5351 }
5352
5353 static void
5354 ztest_execute(int test, ztest_info_t *zi, uint64_t id)
5355 {
5356 ztest_ds_t *zd = &ztest_ds[id % ztest_opts.zo_datasets];
5357 ztest_shared_callstate_t *zc = ZTEST_GET_SHARED_CALLSTATE(test);
5358 hrtime_t functime = gethrtime();
5359
|