X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fdrivers%2Fstaging%2Flustre%2Flnet%2Fselftest%2Ftimer.c;fp=kernel%2Fdrivers%2Fstaging%2Flustre%2Flnet%2Fselftest%2Ftimer.c;h=b98c08a106069aa1274a4f85cbc09f33c35d7a90;hb=e09b41010ba33a20a87472ee821fa407a5b8da36;hp=441f9472a834c698c093ea270dc9e95171655e97;hpb=f93b97fd65072de626c074dbe099a1fff05ce060;p=kvmfornfv.git diff --git a/kernel/drivers/staging/lustre/lnet/selftest/timer.c b/kernel/drivers/staging/lustre/lnet/selftest/timer.c index 441f9472a..b98c08a10 100644 --- a/kernel/drivers/staging/lustre/lnet/selftest/timer.c +++ b/kernel/drivers/staging/lustre/lnet/selftest/timer.c @@ -42,7 +42,6 @@ #include "selftest.h" - /* * Timers are implemented as a sorted queue of expiry times. The queue * is slotted, with each slot holding timers which expire in a @@ -50,7 +49,7 @@ * sorted by increasing expiry time. The number of slots is 2**7 (128), * to cover a time period of 1024 seconds into the future before wrapping. */ -#define STTIMER_MINPOLL 3 /* log2 min poll interval (8 s) */ +#define STTIMER_MINPOLL 3 /* log2 min poll interval (8 s) */ #define STTIMER_SLOTTIME (1 << STTIMER_MINPOLL) #define STTIMER_SLOTTIMEMASK (~(STTIMER_SLOTTIME - 1)) #define STTIMER_NSLOTS (1 << 7) @@ -58,13 +57,13 @@ (STTIMER_NSLOTS - 1))]) static struct st_timer_data { - spinlock_t stt_lock; - /* start time of the slot processed previously */ - unsigned long stt_prev_slot; - struct list_head stt_hash[STTIMER_NSLOTS]; - int stt_shuttingdown; - wait_queue_head_t stt_waitq; - int stt_nthreads; + spinlock_t stt_lock; + unsigned long stt_prev_slot; /* start time of the slot processed + * previously */ + struct list_head stt_hash[STTIMER_NSLOTS]; + int stt_shuttingdown; + wait_queue_head_t stt_waitq; + int stt_nthreads; } stt_data; void @@ -78,13 +77,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, get_seconds())); + 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); @@ -122,15 +121,15 @@ stt_del_timer(stt_timer_t *timer) /* called with stt_data.stt_lock held */ static int -stt_expire_list(struct list_head *slot, unsigned long now) +stt_expire_list(struct list_head *slot, time64_t now) { - int expired = 0; + int expired = 0; stt_timer_t *timer; 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); @@ -148,11 +147,11 @@ stt_expire_list(struct list_head *slot, unsigned long now) static int stt_check_timers(unsigned long *last) { - int expired = 0; - unsigned long now; + int expired = 0; + time64_t now; unsigned long this_slot; - now = get_seconds(); + now = ktime_get_real_seconds(); this_slot = now & STTIMER_SLOTTIMEMASK; spin_lock(&stt_data.stt_lock); @@ -167,7 +166,6 @@ stt_check_timers(unsigned long *last) return expired; } - static int stt_timer_main(void *arg) { @@ -204,7 +202,6 @@ stt_start_timer_thread(void) return 0; } - int stt_startup(void) { @@ -212,7 +209,7 @@ stt_startup(void) int i; stt_data.stt_shuttingdown = 0; - stt_data.stt_prev_slot = get_seconds() & 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++)