Whamcloud - gitweb
LU-4423 lnet: use 64-bit time for selftest
[fs/lustre-release.git] / lnet / selftest / timer.c
index 1dfa817..ff016e9 100644 (file)
@@ -74,13 +74,13 @@ stt_add_timer(stt_timer_t *timer)
        LASSERT(!stt_data.stt_shuttingdown);
        LASSERT(timer->stt_func != NULL);
        LASSERT(list_empty(&timer->stt_list));
-       LASSERT(cfs_time_after(timer->stt_expires, cfs_time_current_sec()));
+       LASSERT(timer->stt_expires > ktime_get_real_seconds());
 
        /* a simple insertion sort */
        list_for_each_prev(pos, STTIMER_SLOT(timer->stt_expires)) {
                stt_timer_t *old = list_entry(pos, stt_timer_t, stt_list);
 
-               if (cfs_time_aftereq(timer->stt_expires, old->stt_expires))
+               if (timer->stt_expires >= old->stt_expires)
                        break;
        }
        list_add(&timer->stt_list, pos);
@@ -118,7 +118,7 @@ stt_del_timer(stt_timer_t *timer)
 
 /* called with stt_data.stt_lock held */
 static int
-stt_expire_list(struct list_head *slot, cfs_time_t now)
+stt_expire_list(struct list_head *slot, time64_t now)
 {
        int          expired = 0;
        stt_timer_t *timer;
@@ -126,7 +126,7 @@ stt_expire_list(struct list_head *slot, cfs_time_t now)
        while (!list_empty(slot)) {
                timer = list_entry(slot->next, stt_timer_t, stt_list);
 
-               if (cfs_time_after(timer->stt_expires, now))
+               if (timer->stt_expires > now)
                        break;
 
                list_del_init(&timer->stt_list);
@@ -142,13 +142,13 @@ stt_expire_list(struct list_head *slot, cfs_time_t now)
 }
 
 static int
-stt_check_timers (cfs_time_t *last)
+stt_check_timers(cfs_time_t *last)
 {
-        int        expired = 0;
-        cfs_time_t now;
+       int expired = 0;
+       time64_t now;
         cfs_time_t this_slot;
 
-        now = cfs_time_current_sec();
+       now = ktime_get_real_seconds();
         this_slot = now & STTIMER_SLOTTIMEMASK;
 
        spin_lock(&stt_data.stt_lock);
@@ -210,7 +210,7 @@ stt_startup (void)
         int i;
 
         stt_data.stt_shuttingdown = 0;
-        stt_data.stt_prev_slot = cfs_time_current_sec() & STTIMER_SLOTTIMEMASK;
+       stt_data.stt_prev_slot = ktime_get_real_seconds() & STTIMER_SLOTTIMEMASK;
 
        spin_lock_init(&stt_data.stt_lock);
         for (i = 0; i < STTIMER_NSLOTS; i++)