X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Fselftest%2Ftimer.c;h=8a35334b065cde4e15c5d68cdd81565e84ed5077;hb=db49fbf00d24edc8347006241f314fb0f82f1b63;hp=1dfa817242d20969c949821571113cca5bd80be5;hpb=72057a3af19ee02d9a686bd7e7d074917e381310;p=fs%2Flustre-release.git diff --git a/lnet/selftest/timer.c b/lnet/selftest/timer.c index 1dfa817..8a35334 100644 --- a/lnet/selftest/timer.c +++ b/lnet/selftest/timer.c @@ -27,7 +27,6 @@ */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. * * lnet/selftest/timer.c * @@ -56,7 +55,7 @@ static struct st_timer_data { spinlock_t stt_lock; /* start time of the slot processed previously */ - cfs_time_t stt_prev_slot; + time64_t stt_prev_slot; struct list_head stt_hash[STTIMER_NSLOTS]; int stt_shuttingdown; wait_queue_head_t stt_waitq; @@ -64,7 +63,7 @@ static struct st_timer_data { } stt_data; void -stt_add_timer(stt_timer_t *timer) +stt_add_timer(struct stt_timer *timer) { struct list_head *pos; @@ -74,13 +73,14 @@ 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); + struct stt_timer *old = list_entry(pos, struct stt_timer, + 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); @@ -98,7 +98,7 @@ stt_add_timer(stt_timer_t *timer) * another CPU. */ int -stt_del_timer(stt_timer_t *timer) +stt_del_timer(struct stt_timer *timer) { int ret = 0; @@ -118,15 +118,15 @@ 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; + struct stt_timer *timer; while (!list_empty(slot)) { - timer = list_entry(slot->next, stt_timer_t, stt_list); + timer = list_entry(slot->next, struct stt_timer, stt_list); - if (cfs_time_after(timer->stt_expires, now)) + if (timer->stt_expires > now) break; list_del_init(&timer->stt_list); @@ -142,20 +142,20 @@ stt_expire_list(struct list_head *slot, cfs_time_t now) } static int -stt_check_timers (cfs_time_t *last) +stt_check_timers(time64_t *last) { - int expired = 0; - cfs_time_t now; - cfs_time_t this_slot; + int expired = 0; + time64_t now; + time64_t this_slot; - now = cfs_time_current_sec(); - this_slot = now & STTIMER_SLOTTIMEMASK; + now = ktime_get_real_seconds(); + this_slot = now & STTIMER_SLOTTIMEMASK; spin_lock(&stt_data.stt_lock); - while (cfs_time_aftereq(this_slot, *last)) { + while (this_slot >= *last) { expired += stt_expire_list(STTIMER_SLOT(this_slot), now); - this_slot = cfs_time_sub(this_slot, STTIMER_SLOTTIME); + this_slot = this_slot - STTIMER_SLOTTIME; } *last = now & STTIMER_SLOTTIMEMASK; @@ -169,8 +169,6 @@ stt_timer_main (void *arg) { int rc = 0; - cfs_block_allsigs(); - while (!stt_data.stt_shuttingdown) { stt_check_timers(&stt_data.stt_prev_slot); @@ -210,7 +208,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++)