static int
brw_inject_one_error(void)
{
- struct timeval tv;
+ struct timespec64 ts;
if (brw_inject_errors <= 0)
return 0;
- do_gettimeofday(&tv);
+ ktime_get_ts64(&ts);
- if ((tv.tv_usec & 1) == 0)
+ if (((ts.tv_nsec / NSEC_PER_USEC) & 1) == 0)
return 0;
return brw_inject_errors--;
mutex_lock(&console_session.ses_mutex);
- console_session.ses_laststamp = get_seconds();
+ console_session.ses_laststamp = ktime_get_real_seconds();
if (console_session.ses_shutdown) {
rc = -ESHUTDOWN;
srpc_debug_reqst_t *drq;
lstcon_ndlink_t *ndl;
lstcon_node_t *nd;
- time_t intv;
+ int intv;
int count = 0;
int rc;
}
if (!console_session.ses_expired &&
- get_seconds() - console_session.ses_laststamp >
- (time_t)console_session.ses_timeout)
+ ktime_get_real_seconds() - console_session.ses_laststamp >
+ (time64_t)console_session.ses_timeout)
console_session.ses_expired = 1;
trans = console_session.ses_ping;
if (nd->nd_state != LST_NODE_ACTIVE)
continue;
- intv = cfs_duration_sec(cfs_time_sub(cfs_time_current(),
- nd->nd_stamp));
- if (intv < (time_t)nd->nd_timeout / 2)
+ intv = (jiffies - nd->nd_stamp) / HZ;
+ if (intv < nd->nd_timeout / 2)
continue;
rc = lstcon_rpc_init(nd, SRPC_SERVICE_DEBUG,
CDEBUG(D_NET, "Ping %d nodes in session\n", count);
- ptimer->stt_expires = (unsigned long)(get_seconds() + LST_PING_INTERVAL);
+ ptimer->stt_expires = ktime_get_real_seconds() + LST_PING_INTERVAL;
stt_add_timer(ptimer);
mutex_unlock(&console_session.ses_mutex);
}
ptimer = &console_session.ses_ping_timer;
- ptimer->stt_expires = (unsigned long)(get_seconds() + LST_PING_INTERVAL);
+ ptimer->stt_expires = ktime_get_real_seconds() + 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 = get_seconds();
+ console_session.ses_laststamp = ktime_get_real_seconds();
mutex_init(&console_session.ses_mutex);
int ses_key; /* local session key */
int ses_state; /* state of session */
int ses_timeout; /* timeout in seconds */
- time_t ses_laststamp; /* last operation stamp (seconds)
+ time64_t ses_laststamp; /* last operation stamp (seconds)
*/
unsigned ses_features; /* tests features of the session
*/
LASSERT(!sn->sn_timer_active);
sn->sn_timer_active = 1;
- timer->stt_expires = cfs_time_add(sn->sn_timeout,
- get_seconds());
+ timer->stt_expires = ktime_get_real_seconds() + sn->sn_timeout;
stt_add_timer(timer);
return;
}
}
if (rc != 0) {
- scd->scd_buf_err_stamp = get_seconds();
+ scd->scd_buf_err_stamp = ktime_get_real_seconds();
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 = cfs_time_add(rpc->crpc_timeout,
- get_seconds());
+ timer->stt_expires = ktime_get_real_seconds() + rpc->crpc_timeout;
stt_add_timer(timer);
return;
}
}
if (scd->scd_buf_err_stamp != 0 &&
- scd->scd_buf_err_stamp < get_seconds()) {
+ scd->scd_buf_err_stamp < ktime_get_real_seconds()) {
/* 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) get_seconds()) << 48;
+ srpc_data.rpc_matchbits = ((__u64)ktime_get_real_seconds()) << 48;
srpc_data.rpc_state = SRPC_STATE_NONE;
/** error code for scd_buf_wi */
int scd_buf_err;
/** timestamp for scd_buf_err */
- unsigned long scd_buf_err_stamp;
+ time64_t 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(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);
/* 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;
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);
stt_check_timers(unsigned long *last)
{
int expired = 0;
- unsigned long now;
+ 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);
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++)
typedef struct {
struct list_head stt_list;
- unsigned long stt_expires;
+ time64_t stt_expires;
void (*stt_func) (void *);
void *stt_data;
} stt_timer_t;