Deleted Added
sdiff udiff text old ( 276082 ) new ( 277576 )
full compact
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 409 unchanged lines hidden (view full) ---

418dsl_scan_sync_state(dsl_scan_t *scn, dmu_tx_t *tx)
419{
420 VERIFY0(zap_update(scn->scn_dp->dp_meta_objset,
421 DMU_POOL_DIRECTORY_OBJECT,
422 DMU_POOL_SCAN, sizeof (uint64_t), SCAN_PHYS_NUMINTS,
423 &scn->scn_phys, tx));
424}
425
426static boolean_t
427dsl_scan_check_pause(dsl_scan_t *scn, const zbookmark_phys_t *zb)
428{
429 uint64_t elapsed_nanosecs;
430 unsigned int mintime;
431
432 /* we never skip user/group accounting objects */
433 if (zb && (int64_t)zb->zb_object < 0)
434 return (B_FALSE);
435
436 if (scn->scn_pausing)
437 return (B_TRUE); /* we're already pausing */
438
439 if (!ZB_IS_ZERO(&scn->scn_phys.scn_bookmark))
440 return (B_FALSE); /* we're resuming */
441
442 /* We only know how to resume from level-0 blocks. */
443 if (zb && zb->zb_level != 0)
444 return (B_FALSE);
445
446 mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ?
447 zfs_resilver_min_time_ms : zfs_scan_min_time_ms;
448 elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time;
449 if (elapsed_nanosecs / NANOSEC > zfs_txg_timeout ||
450 (NSEC2MSEC(elapsed_nanosecs) > mintime &&
451 txg_sync_waiting(scn->scn_dp)) ||
452 spa_shutting_down(scn->scn_dp->dp_spa)) {
453 if (zb) {
454 dprintf("pausing at bookmark %llx/%llx/%llx/%llx\n",
455 (longlong_t)zb->zb_objset,
456 (longlong_t)zb->zb_object,
457 (longlong_t)zb->zb_level,
458 (longlong_t)zb->zb_blkid);
459 scn->scn_phys.scn_bookmark = *zb;

--- 1362 unchanged lines hidden ---