void
lnet_notify_locked(struct lnet_peer_ni *lp, int notifylnd, int alive,
- cfs_time_t when)
+ time64_t when)
{
- if (cfs_time_before(when, lp->lpni_timestamp)) { /* out of date information */
+ if (lp->lpni_timestamp > when) { /* out of date information */
CDEBUG(D_NET, "Out of date\n");
return;
}
*/
spin_lock(&lp->lpni_lock);
- lp->lpni_timestamp = when; /* update timestamp */
+ lp->lpni_timestamp = when; /* update timestamp */
lp->lpni_ping_deadline = 0; /* disable ping timeout */
if (lp->lpni_alive_count != 0 && /* got old news */
* we ping alive routers to try to detect router death before
* apps get burned). */
- lnet_notify_locked(lp, 1, (event->status == 0), cfs_time_current());
+ lnet_notify_locked(lp, 1, !event->status, ktime_get_seconds());
/* The router checker will wake up very shortly and do the
* actual notification.
* XXX If 'lp' stops being a router before then, it will still
{
struct lnet_ni *ni = NULL;
time64_t now;
- int timeout;
+ time64_t timeout;
LASSERT(the_lnet.ln_routing);
LASSERT(ni->ni_status != NULL);
if (ni->ni_status->ns_status != LNET_NI_STATUS_DOWN) {
- CDEBUG(D_NET, "NI(%s:%d) status changed to down\n",
+ CDEBUG(D_NET, "NI(%s:%lld) status changed to down\n",
libcfs_nid2str(ni->ni_nid), timeout);
/* NB: so far, this is the only place to set
* NI status to "down" */
lnet_ping_router_locked(struct lnet_peer_ni *rtr)
{
struct lnet_rc_data *rcd = NULL;
- cfs_time_t now = cfs_time_current();
- int secs;
- struct lnet_ni *ni;
+ time64_t now = ktime_get_seconds();
+ time64_t secs;
+ struct lnet_ni *ni;
lnet_peer_ni_addref_locked(rtr);
if (rtr->lpni_ping_deadline != 0 && /* ping timed out? */
- cfs_time_after(now, rtr->lpni_ping_deadline))
+ now > rtr->lpni_ping_deadline)
lnet_notify_locked(rtr, 1, 0, now);
/* Run any outstanding notifications */
secs = lnet_router_check_interval(rtr);
CDEBUG(D_NET,
- "rtr %s %d: deadline %lu ping_notsent %d alive %d "
- "alive_count %d lpni_ping_timestamp %lu\n",
+ "rtr %s %lld: deadline %lld ping_notsent %d alive %d "
+ "alive_count %d lpni_ping_timestamp %lld\n",
libcfs_nid2str(rtr->lpni_nid), secs,
rtr->lpni_ping_deadline, rtr->lpni_ping_notsent,
rtr->lpni_alive, rtr->lpni_alive_count, rtr->lpni_ping_timestamp);
if (secs != 0 && !rtr->lpni_ping_notsent &&
- cfs_time_after(now, cfs_time_add(rtr->lpni_ping_timestamp,
- cfs_time_seconds(secs)))) {
+ now > rtr->lpni_ping_timestamp + secs) {
int rc;
struct lnet_process_id id;
struct lnet_handle_md mdh;
mdh = rcd->rcd_mdh;
if (rtr->lpni_ping_deadline == 0) {
- rtr->lpni_ping_deadline =
- cfs_time_shift(router_ping_timeout);
+ rtr->lpni_ping_deadline = ktime_get_seconds() +
+ router_ping_timeout;
}
lnet_net_unlock(rtr->lpni_cpt);
}
int
-lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, cfs_time_t when)
+lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, time64_t when)
{
struct lnet_peer_ni *lp = NULL;
- cfs_time_t now = cfs_time_current();
+ time64_t now = ktime_get_seconds();
int cpt = lnet_cpt_of_nid(nid, ni);
LASSERT (!in_interrupt ());
}
/* can't do predictions... */
- if (cfs_time_after(when, now)) {
+ if (when > now) {
CWARN("Ignoring prediction from %s of %s %s "
- "%ld seconds in the future\n",
+ "%lld seconds in the future\n",
(ni == NULL) ? "userspace" : libcfs_nid2str(ni->ni_nid),
- libcfs_nid2str(nid), alive ? "up" : "down",
- cfs_duration_sec(cfs_time_sub(when, now)));
+ libcfs_nid2str(nid), alive ? "up" : "down", when - now);
return -EINVAL;
}