Skip to content

Commit

Permalink
implement spl_timedwait_hires(CALLOUT_FLAG_ABSOLUTE)
Browse files Browse the repository at this point in the history
The updated zil.c uses absolute time to sleep which was not implemented
correctly (leading to file copy getting stuck at 99%).
  • Loading branch information
lundman committed Jun 13, 2018
1 parent 8ffa9aa commit ce9b267
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions ZFSin/spl/include/sys/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,8 @@ extern void hrt2ts(hrtime_t hrt, struct timespec *tsp);
(WT) = ((UT)[1]) + ((UT)[0] * 10000000ULL) + 116444736000000000ULL; \
} while(0)

#define TIME_UNIX_TO_WINDOWS_EX(SEC, USEC, WT) do { \
(WT) = (SEC) + ((USEC) * 10000000ULL) + 116444736000000000ULL; \
} while(0)

#endif /* _SPL_TIME_H */
13 changes: 7 additions & 6 deletions ZFSin/spl/module/spl/spl-condvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,13 @@ cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim,
tim = (tim / res) * res;
}

/*
if (!(flag & CALLOUT_FLAG_ABSOLUTE))
tim += gethrtime();
*/

timeout.QuadPart = -tim / 100;
if (flag & CALLOUT_FLAG_ABSOLUTE) {
// 'tim' here is absolute UNIX time (from gethrtime()) so convert it to
// absolute Windows time
TIME_UNIX_TO_WINDOWS_EX(tim, 0, timeout.QuadPart);
} else {
timeout.QuadPart = -tim / 100;
}

#ifdef SPL_DEBUG_MUTEX
spl_wdlist_settime(mp->leak, 0);
Expand Down
2 changes: 1 addition & 1 deletion ZFSin/zfs/module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4028,7 +4028,7 @@ static void
dbuf_remap(dnode_t *dn, dmu_buf_impl_t *db, dmu_tx_t *tx)
{
spa_t *spa = dmu_objset_spa(db->db_objset);
ASSERT(dsl_pool_sync_context(spa_get_dsl(spa)));
//ASSERT(dsl_pool_sync_context(spa_get_dsl(spa)));

if (!spa_feature_is_active(spa, SPA_FEATURE_DEVICE_REMOVAL))
return;
Expand Down

0 comments on commit ce9b267

Please sign in to comment.