mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Avoid two 64-bit divisions per scanned block
Change math to make it like the ARC, using multiplications instead. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored-By: iXsystems, Inc. Closes #13591
This commit is contained in:
parent
c0bf952c84
commit
1cd72b9c13
@ -1342,12 +1342,13 @@ dsl_scan_check_suspend(dsl_scan_t *scn, const zbookmark_phys_t *zb)
|
|||||||
uint64_t scan_time_ns = curr_time_ns - scn->scn_sync_start_time;
|
uint64_t scan_time_ns = curr_time_ns - scn->scn_sync_start_time;
|
||||||
uint64_t sync_time_ns = curr_time_ns -
|
uint64_t sync_time_ns = curr_time_ns -
|
||||||
scn->scn_dp->dp_spa->spa_sync_starttime;
|
scn->scn_dp->dp_spa->spa_sync_starttime;
|
||||||
int dirty_pct = scn->scn_dp->dp_dirty_total * 100 / zfs_dirty_data_max;
|
uint64_t dirty_min_bytes = zfs_dirty_data_max *
|
||||||
|
zfs_vdev_async_write_active_min_dirty_percent / 100;
|
||||||
int mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ?
|
int mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ?
|
||||||
zfs_resilver_min_time_ms : zfs_scrub_min_time_ms;
|
zfs_resilver_min_time_ms : zfs_scrub_min_time_ms;
|
||||||
|
|
||||||
if ((NSEC2MSEC(scan_time_ns) > mintime &&
|
if ((NSEC2MSEC(scan_time_ns) > mintime &&
|
||||||
(dirty_pct >= zfs_vdev_async_write_active_min_dirty_percent ||
|
(scn->scn_dp->dp_dirty_total >= dirty_min_bytes ||
|
||||||
txg_sync_waiting(scn->scn_dp) ||
|
txg_sync_waiting(scn->scn_dp) ||
|
||||||
NSEC2SEC(sync_time_ns) >= zfs_txg_timeout)) ||
|
NSEC2SEC(sync_time_ns) >= zfs_txg_timeout)) ||
|
||||||
spa_shutting_down(scn->scn_dp->dp_spa) ||
|
spa_shutting_down(scn->scn_dp->dp_spa) ||
|
||||||
@ -2833,12 +2834,13 @@ scan_io_queue_check_suspend(dsl_scan_t *scn)
|
|||||||
uint64_t scan_time_ns = curr_time_ns - scn->scn_sync_start_time;
|
uint64_t scan_time_ns = curr_time_ns - scn->scn_sync_start_time;
|
||||||
uint64_t sync_time_ns = curr_time_ns -
|
uint64_t sync_time_ns = curr_time_ns -
|
||||||
scn->scn_dp->dp_spa->spa_sync_starttime;
|
scn->scn_dp->dp_spa->spa_sync_starttime;
|
||||||
int dirty_pct = scn->scn_dp->dp_dirty_total * 100 / zfs_dirty_data_max;
|
uint64_t dirty_min_bytes = zfs_dirty_data_max *
|
||||||
|
zfs_vdev_async_write_active_min_dirty_percent / 100;
|
||||||
int mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ?
|
int mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ?
|
||||||
zfs_resilver_min_time_ms : zfs_scrub_min_time_ms;
|
zfs_resilver_min_time_ms : zfs_scrub_min_time_ms;
|
||||||
|
|
||||||
return ((NSEC2MSEC(scan_time_ns) > mintime &&
|
return ((NSEC2MSEC(scan_time_ns) > mintime &&
|
||||||
(dirty_pct >= zfs_vdev_async_write_active_min_dirty_percent ||
|
(scn->scn_dp->dp_dirty_total >= dirty_min_bytes ||
|
||||||
txg_sync_waiting(scn->scn_dp) ||
|
txg_sync_waiting(scn->scn_dp) ||
|
||||||
NSEC2SEC(sync_time_ns) >= zfs_txg_timeout)) ||
|
NSEC2SEC(sync_time_ns) >= zfs_txg_timeout)) ||
|
||||||
spa_shutting_down(scn->scn_dp->dp_spa));
|
spa_shutting_down(scn->scn_dp->dp_spa));
|
||||||
|
Loading…
Reference in New Issue
Block a user