Use nstosbt() instead of multiplying by SBT_1NS to avoid roundoff errors.

Differential Revision:	https://reviews.freebsd.org/D11779
This commit is contained in:
Ian Lepore 2017-09-25 15:03:27 +00:00
parent 40c2a6da0d
commit a78b4d1462
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323985
2 changed files with 3 additions and 8 deletions

View File

@ -63,13 +63,8 @@ static clock_t
cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,
int flag)
{
sbintime_t sbt;
sbintime_t pr;
sbt = tim * SBT_1NS;
pr = res * SBT_1NS;
return (cv_timedwait_sbt(cvp, mp, sbt, pr, 0));
return (cv_timedwait_sbt(cvp, mp, nstosbt(tim), nstosbt(res), 0));
}
#endif /* _KERNEL */

View File

@ -806,8 +806,8 @@ dmu_tx_delay(dmu_tx_t *tx, uint64_t dirty)
continue;
mutex_exit(&curthread->t_delay_lock);
#else
pause_sbt("dmu_tx_delay", wakeup * SBT_1NS,
zfs_delay_resolution_ns * SBT_1NS, C_ABSOLUTE);
pause_sbt("dmu_tx_delay", nstosbt(wakeup),
nstosbt(zfs_delay_resolution_ns), C_ABSOLUTE);
#endif
#else
hrtime_t delta = wakeup - gethrtime();