dsl_scan.c (275530) | dsl_scan.c (275738) |
---|---|
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 --- 400 unchanged lines hidden (view full) --- 409dsl_scan_sync_state(dsl_scan_t *scn, dmu_tx_t *tx) 410{ 411 VERIFY0(zap_update(scn->scn_dp->dp_meta_objset, 412 DMU_POOL_DIRECTORY_OBJECT, 413 DMU_POOL_SCAN, sizeof (uint64_t), SCAN_PHYS_NUMINTS, 414 &scn->scn_phys, tx)); 415} 416 | 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 --- 400 unchanged lines hidden (view full) --- 409dsl_scan_sync_state(dsl_scan_t *scn, dmu_tx_t *tx) 410{ 411 VERIFY0(zap_update(scn->scn_dp->dp_meta_objset, 412 DMU_POOL_DIRECTORY_OBJECT, 413 DMU_POOL_SCAN, sizeof (uint64_t), SCAN_PHYS_NUMINTS, 414 &scn->scn_phys, tx)); 415} 416 |
417extern int zfs_vdev_async_write_active_min_dirty_percent; 418 |
|
417static boolean_t 418dsl_scan_check_pause(dsl_scan_t *scn, const zbookmark_phys_t *zb) 419{ | 419static boolean_t 420dsl_scan_check_pause(dsl_scan_t *scn, const zbookmark_phys_t *zb) 421{ |
420 uint64_t elapsed_nanosecs; 421 unsigned int mintime; 422 | |
423 /* we never skip user/group accounting objects */ 424 if (zb && (int64_t)zb->zb_object < 0) 425 return (B_FALSE); 426 427 if (scn->scn_pausing) 428 return (B_TRUE); /* we're already pausing */ 429 430 if (!ZB_IS_ZERO(&scn->scn_phys.scn_bookmark)) 431 return (B_FALSE); /* we're resuming */ 432 433 /* We only know how to resume from level-0 blocks. */ 434 if (zb && zb->zb_level != 0) 435 return (B_FALSE); 436 | 422 /* we never skip user/group accounting objects */ 423 if (zb && (int64_t)zb->zb_object < 0) 424 return (B_FALSE); 425 426 if (scn->scn_pausing) 427 return (B_TRUE); /* we're already pausing */ 428 429 if (!ZB_IS_ZERO(&scn->scn_phys.scn_bookmark)) 430 return (B_FALSE); /* we're resuming */ 431 432 /* We only know how to resume from level-0 blocks. */ 433 if (zb && zb->zb_level != 0) 434 return (B_FALSE); 435 |
437 mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ? | 436 /* 437 * We pause if: 438 * - we have scanned for the maximum time: an entire txg 439 * timeout (default 5 sec) 440 * or 441 * - we have scanned for at least the minimum time (default 1 sec 442 * for scrub, 3 sec for resilver), and either we have sufficient 443 * dirty data that we are starting to write more quickly 444 * (default 30%), or someone is explicitly waiting for this txg 445 * to complete. 446 * or 447 * - the spa is shutting down because this pool is being exported 448 * or the machine is rebooting. 449 */ 450 int mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ? |
438 zfs_resilver_min_time_ms : zfs_scan_min_time_ms; | 451 zfs_resilver_min_time_ms : zfs_scan_min_time_ms; |
439 elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time; 440 if (elapsed_nanosecs / NANOSEC > zfs_txg_timeout || | 452 uint64_t elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time; 453 int dirty_pct = scn->scn_dp->dp_dirty_total * 100 / zfs_dirty_data_max; 454 if (elapsed_nanosecs / NANOSEC >= zfs_txg_timeout || |
441 (NSEC2MSEC(elapsed_nanosecs) > mintime && | 455 (NSEC2MSEC(elapsed_nanosecs) > mintime && |
442 txg_sync_waiting(scn->scn_dp)) || | 456 (txg_sync_waiting(scn->scn_dp) || 457 dirty_pct >= zfs_vdev_async_write_active_min_dirty_percent)) || |
443 spa_shutting_down(scn->scn_dp->dp_spa)) { 444 if (zb) { 445 dprintf("pausing at bookmark %llx/%llx/%llx/%llx\n", 446 (longlong_t)zb->zb_objset, 447 (longlong_t)zb->zb_object, 448 (longlong_t)zb->zb_level, 449 (longlong_t)zb->zb_blkid); 450 scn->scn_phys.scn_bookmark = *zb; --- 1362 unchanged lines hidden --- | 458 spa_shutting_down(scn->scn_dp->dp_spa)) { 459 if (zb) { 460 dprintf("pausing at bookmark %llx/%llx/%llx/%llx\n", 461 (longlong_t)zb->zb_objset, 462 (longlong_t)zb->zb_object, 463 (longlong_t)zb->zb_level, 464 (longlong_t)zb->zb_blkid); 465 scn->scn_phys.scn_bookmark = *zb; --- 1362 unchanged lines hidden --- |