* The second that peers are pulled out from \a kib_reconn_wait
* for reconnection.
*/
- time64_t kib_reconn_sec;
+ unsigned int kib_reconn_sec;
/* connection daemon sleeps here */
wait_queue_head_t kib_connd_waitq;
spinlock_t kib_connd_lock; /* serialise */
}
while (reconn < KIB_RECONN_BREAK) {
- if (kiblnd_data.kib_reconn_sec !=
- ktime_get_real_seconds()) {
- kiblnd_data.kib_reconn_sec = ktime_get_real_seconds();
+ if (kiblnd_data.kib_reconn_sec != get_seconds()) {
+ kiblnd_data.kib_reconn_sec = get_seconds();
list_splice_init(&kiblnd_data.kib_reconn_wait,
&kiblnd_data.kib_reconn_list);
}
}
conn->ksnc_peer = peer_ni; /* conn takes my ref on peer_ni */
- peer_ni->ksnp_last_alive = ktime_get_real_seconds();
+ peer_ni->ksnp_last_alive = cfs_time_current();
peer_ni->ksnp_send_keepalive = 0;
peer_ni->ksnp_error = 0;
sched->kss_nconns++;
conn->ksnc_scheduler = sched;
- conn->ksnc_tx_last_post = ktime_get_real_seconds();
+ conn->ksnc_tx_last_post = cfs_time_current();
/* Set the deadline for the outgoing HELLO to drain */
conn->ksnc_tx_bufnob = sock->sk->sk_wmem_queued;
conn->ksnc_tx_deadline = cfs_time_shift(*ksocknal_tunables.ksnd_timeout);
libcfs_id2str(conn->ksnc_peer->ksnp_id), conn->ksnc_type,
&conn->ksnc_ipaddr, conn->ksnc_port,
conn->ksnc_rx_nob_wanted, conn->ksnc_rx_nob_left,
- cfs_duration_sec(cfs_time_sub(ktime_get_real_seconds(),
+ cfs_duration_sec(cfs_time_sub(cfs_time_current(),
last_rcv)));
lnet_finalize(conn->ksnc_cookie, -EIO);
break;
ksocknal_query(struct lnet_ni *ni, lnet_nid_t nid, cfs_time_t *when)
{
int connect = 1;
- time64_t last_alive = 0;
- time64_t now = ktime_get_real_seconds();
+ cfs_time_t last_alive = 0;
+ cfs_time_t now = cfs_time_current();
ksock_peer_ni_t *peer_ni = NULL;
rwlock_t *glock = &ksocknal_data.ksnd_global_lock;
struct lnet_process_id id = {
ksocknal_data.ksnd_connd_starting = 0;
ksocknal_data.ksnd_connd_failed_stamp = 0;
- ksocknal_data.ksnd_connd_starting_stamp = ktime_get_real_seconds();
+ ksocknal_data.ksnd_connd_starting_stamp = cfs_time_current_sec();
/* must have at least 2 connds to remain responsive to accepts while
* connecting */
if (*ksocknal_tunables.ksnd_nconnds < SOCKNAL_CONND_RESV + 1)
/* # connds connecting */
int ksnd_connd_connecting;
/** time stamp of the last failed connecting attempt */
- time64_t ksnd_connd_failed_stamp;
+ long ksnd_connd_failed_stamp;
/** # starting connd */
unsigned ksnd_connd_starting;
/** time stamp of the last starting connd */
- time64_t ksnd_connd_starting_stamp;
+ long ksnd_connd_starting_stamp;
/** # running connd */
unsigned ksnd_connd_running;
/* serialise */
* running out of resource.
*/
static int
-ksocknal_connd_check_start(time64_t sec, long *timeout)
+ksocknal_connd_check_start(long sec, long *timeout)
{
char name[16];
int rc;
/* we tried ... */
LASSERT(ksocknal_data.ksnd_connd_starting > 0);
ksocknal_data.ksnd_connd_starting--;
- ksocknal_data.ksnd_connd_failed_stamp = ktime_get_real_seconds();
+ ksocknal_data.ksnd_connd_failed_stamp = cfs_time_current_sec();
return 1;
}
* again to recheck these conditions.
*/
static int
-ksocknal_connd_check_stop(time64_t sec, long *timeout)
+ksocknal_connd_check_stop(long sec, long *timeout)
{
int val;
while (!ksocknal_data.ksnd_shuttingdown) {
ksock_route_t *route = NULL;
- time64_t sec = ktime_get_real_seconds();
+ long sec = cfs_time_current_sec();
long timeout = MAX_SCHEDULE_TIMEOUT;
int dropped_lock = 0;
return rc;
}
- case IOC_LIBCFS_NOTIFY_ROUTER: {
- unsigned long jiffies_passed;
-
- jiffies_passed = ktime_get_real_seconds() - data->ioc_u64[0];
- jiffies_passed = cfs_time_seconds(jiffies_passed);
-
+ case IOC_LIBCFS_NOTIFY_ROUTER:
return lnet_notify(NULL, data->ioc_nid, data->ioc_flags,
- jiffies - jiffies_passed);
- }
+ cfs_time_current() -
+ cfs_time_seconds(cfs_time_current_sec() -
+ (time_t)data->ioc_u64[0]));
case IOC_LIBCFS_LNET_DIST:
rc = LNetDist(data->ioc_nid, &data->ioc_nid, &data->ioc_u32[1]);
else
ni->ni_net_ns = NULL;
- ni->ni_last_alive = ktime_get_real_seconds();
+ ni->ni_last_alive = cfs_time_current_sec();
ni->ni_state = LNET_NI_STATE_INIT;
list_add_tail(&ni->ni_netlist, &net->net_ni_added);
}
if (the_lnet.ln_routing &&
- ni->ni_last_alive != ktime_get_real_seconds()) {
+ ni->ni_last_alive != cfs_time_current_sec()) {
/* NB: so far here is the only place to set NI status to "up */
lnet_ni_lock(ni);
- ni->ni_last_alive = ktime_get_real_seconds();
+ ni->ni_last_alive = cfs_time_current_sec();
if (ni->ni_status != NULL &&
ni->ni_status->ns_status == LNET_NI_STATUS_DOWN)
ni->ni_status->ns_status = LNET_NI_STATUS_UP;
lnet_update_ni_status_locked(void)
{
struct lnet_ni *ni = NULL;
- time64_t now;
+ long now;
int timeout;
LASSERT(the_lnet.ln_routing);
timeout = router_ping_timeout +
MAX(live_router_check_interval, dead_router_check_interval);
- now = ktime_get_real_seconds();
+ now = cfs_time_current_sec();
while ((ni = lnet_get_next_ni_locked(NULL, ni))) {
if (ni->ni_net->net_lnd->lnd_type == LOLND)
continue;
if (ni != NULL) {
struct lnet_tx_queue *tq;
char *stat;
- time64_t now = ktime_get_real_seconds();
+ long now = cfs_time_current_sec();
int last_alive = -1;
int i;
int j;
mutex_lock(&console_session.ses_mutex);
- console_session.ses_laststamp = ktime_get_real_seconds();
+ console_session.ses_laststamp = cfs_time_current_sec();
if (console_session.ses_shutdown) {
rc = -ESHUTDOWN;
}
if (!console_session.ses_expired &&
- ktime_get_real_seconds() - console_session.ses_laststamp >
- (time64_t)console_session.ses_timeout)
+ cfs_time_current_sec() - console_session.ses_laststamp >
+ (time_t)console_session.ses_timeout)
console_session.ses_expired = 1;
trans = console_session.ses_ping;
CDEBUG(D_NET, "Ping %d nodes in session\n", count);
- ptimer->stt_expires = ktime_get_real_seconds() + LST_PING_INTERVAL;
+ ptimer->stt_expires = (cfs_time_t)(cfs_time_current_sec() + LST_PING_INTERVAL);
stt_add_timer(ptimer);
mutex_unlock(&console_session.ses_mutex);
}
ptimer = &console_session.ses_ping_timer;
- ptimer->stt_expires = ktime_get_real_seconds() + LST_PING_INTERVAL;
+ ptimer->stt_expires = (cfs_time_t)(cfs_time_current_sec() + LST_PING_INTERVAL);
stt_add_timer(ptimer);
console_session.ses_expired = 0;
console_session.ses_feats_updated = 0;
console_session.ses_features = LST_FEATS_MASK;
- console_session.ses_laststamp = ktime_get_real_seconds();
+ console_session.ses_laststamp = cfs_time_current_sec();
mutex_init(&console_session.ses_mutex);
int ses_key; /* local session key */
int ses_state; /* state of session */
int ses_timeout; /* timeout in seconds */
- time64_t ses_laststamp; /* last operation stamp (seconds) */
+ time_t ses_laststamp; /* last operation stamp (seconds) */
/** tests features of the session */
unsigned ses_features;
/** features are synced with remote test nodes */
LASSERT (!sn->sn_timer_active);
sn->sn_timer_active = 1;
- timer->stt_expires = ktime_get_real_seconds()+ sn->sn_timeout;
+ timer->stt_expires = cfs_time_add(sn->sn_timeout,
+ cfs_time_current_sec());
stt_add_timer(timer);
return;
}
}
if (rc != 0) {
- scd->scd_buf_err_stamp = ktime_get_real_seconds();
+ scd->scd_buf_err_stamp = cfs_time_current_sec();
scd->scd_buf_err = rc;
LASSERT(scd->scd_buf_posting > 0);
INIT_LIST_HEAD(&timer->stt_list);
timer->stt_data = rpc;
timer->stt_func = srpc_client_rpc_expired;
- timer->stt_expires = ktime_get_real_seconds() + rpc->crpc_timeout;
+ timer->stt_expires = cfs_time_add(rpc->crpc_timeout,
+ cfs_time_current_sec());
stt_add_timer(timer);
return;
}
}
if (scd->scd_buf_err_stamp != 0 &&
- scd->scd_buf_err_stamp < ktime_get_real_seconds()) {
+ scd->scd_buf_err_stamp < cfs_time_current_sec()) {
/* re-enable adding buffer */
scd->scd_buf_err_stamp = 0;
scd->scd_buf_err = 0;
/* 1 second pause to avoid timestamp reuse */
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cfs_time_seconds(1));
- srpc_data.rpc_matchbits = ((__u64) ktime_get_real_seconds()) << 48;
+ srpc_data.rpc_matchbits = ((__u64) cfs_time_current_sec()) << 48;
srpc_data.rpc_state = SRPC_STATE_NONE;
/** error code for scd_buf_wi */
int scd_buf_err;
/** timestamp for scd_buf_err */
- time64_t scd_buf_err_stamp;
+ unsigned long scd_buf_err_stamp;
/** total # request buffers */
int scd_buf_total;
/** # posted request buffers */
LASSERT(!stt_data.stt_shuttingdown);
LASSERT(timer->stt_func != NULL);
LASSERT(list_empty(&timer->stt_list));
- LASSERT(timer->stt_expires > ktime_get_real_seconds());
+ LASSERT(cfs_time_after(timer->stt_expires, cfs_time_current_sec()));
/* a simple insertion sort */
list_for_each_prev(pos, STTIMER_SLOT(timer->stt_expires)) {
/* called with stt_data.stt_lock held */
static int
-stt_expire_list(struct list_head *slot, time64_t now)
+stt_expire_list(struct list_head *slot, cfs_time_t now)
{
int expired = 0;
stt_timer_t *timer;
stt_check_timers(cfs_time_t *last)
{
int expired = 0;
- time64_t now;
+ cfs_time_t now;
cfs_time_t this_slot;
- now = ktime_get_real_seconds();
+ now = cfs_time_current_sec();
this_slot = now & STTIMER_SLOTTIMEMASK;
spin_lock(&stt_data.stt_lock);
int i;
stt_data.stt_shuttingdown = 0;
- stt_data.stt_prev_slot = ktime_get_real_seconds() & STTIMER_SLOTTIMEMASK;
+ stt_data.stt_prev_slot = cfs_time_current_sec() & STTIMER_SLOTTIMEMASK;
spin_lock_init(&stt_data.stt_lock);
for (i = 0; i < STTIMER_NSLOTS; i++)
typedef struct {
struct list_head stt_list;
- time64_t stt_expires;
+ cfs_time_t stt_expires;
void (*stt_func)(void *);
void *stt_data;
} stt_timer_t;