From b4b7ff4b08e691656c9d77c758fc355833128ac0 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Wed, 20 Jan 2016 14:01:31 -0300 Subject: Linux-libre 4.4-gnu --- drivers/staging/lustre/lnet/selftest/brw_test.c | 6 +++--- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- drivers/staging/lustre/lnet/selftest/conrpc.c | 20 ++++++++---------- drivers/staging/lustre/lnet/selftest/conrpc.h | 5 ++--- drivers/staging/lustre/lnet/selftest/console.c | 20 ++++++++---------- drivers/staging/lustre/lnet/selftest/console.h | 3 +-- drivers/staging/lustre/lnet/selftest/framework.c | 12 ++--------- drivers/staging/lustre/lnet/selftest/module.c | 1 - drivers/staging/lustre/lnet/selftest/ping_test.c | 16 +++++++------- drivers/staging/lustre/lnet/selftest/rpc.c | 13 +++++------- drivers/staging/lustre/lnet/selftest/rpc.h | 1 - drivers/staging/lustre/lnet/selftest/selftest.h | 27 +++++++++++------------- drivers/staging/lustre/lnet/selftest/timer.c | 17 ++++++--------- drivers/staging/lustre/lnet/selftest/timer.h | 2 +- 14 files changed, 61 insertions(+), 86 deletions(-) (limited to 'drivers/staging/lustre/lnet/selftest') diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index de11f1bc8..0605c651f 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -134,14 +134,14 @@ brw_client_init(sfw_test_instance_t *tsi) 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--; diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 1a7870e91..556c837cf 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -441,7 +441,7 @@ lst_group_info_ioctl(lstio_group_info_args_t *args) if (args->lstio_grp_dentsp != NULL && (copy_to_user(args->lstio_grp_idxp, &index, sizeof(index)) || copy_to_user(args->lstio_grp_ndentp, &ndent, sizeof(ndent)))) - rc = -EFAULT; + return -EFAULT; return 0; } @@ -837,7 +837,7 @@ lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_data *data) 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; diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index a1a4e08f7..64a033593 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -40,7 +40,6 @@ * Author: Liang Zhen */ - #include "../../include/linux/libcfs/libcfs.h" #include "../../include/linux/lnet/lib-lnet.h" #include "timer.h" @@ -505,7 +504,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, dur = (long)cfs_time_sub(crpc->crp_stamp, (unsigned long)console_session.ses_id.ses_stamp); - cfs_duration_usec(dur, &tv); + jiffies_to_timeval(dur, &tv); if (copy_to_user(&ent->rpe_peer, &nd->nd_id, sizeof(lnet_process_id_t)) || @@ -861,7 +860,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, bulk->bk_iovs[i].kiov_offset = 0; bulk->bk_iovs[i].kiov_len = len; bulk->bk_iovs[i].kiov_page = - alloc_page(GFP_IOFS); + alloc_page(GFP_KERNEL); if (bulk->bk_iovs[i].kiov_page == NULL) { lstcon_rpc_put(*crpc); @@ -1176,7 +1175,7 @@ lstcon_rpc_pinger(void *arg) srpc_debug_reqst_t *drq; lstcon_ndlink_t *ndl; lstcon_node_t *nd; - time_t intv; + int intv; int count = 0; int rc; @@ -1191,8 +1190,8 @@ lstcon_rpc_pinger(void *arg) } 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; @@ -1248,9 +1247,8 @@ lstcon_rpc_pinger(void *arg) 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, @@ -1278,7 +1276,7 @@ lstcon_rpc_pinger(void *arg) 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); @@ -1301,7 +1299,7 @@ lstcon_rpc_pinger_start(void) } 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); diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.h b/drivers/staging/lustre/lnet/selftest/conrpc.h index 7d33cf9e9..95c832ff7 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.h +++ b/drivers/staging/lustre/lnet/selftest/conrpc.h @@ -105,8 +105,8 @@ typedef struct lstcon_rpc_trans { #define LST_TRANS_STATQRY 0x21 -typedef int (* lstcon_rpc_cond_func_t)(int, struct lstcon_node *, void *); -typedef int (* lstcon_rpc_readent_func_t)(int, srpc_msg_t *, lstcon_rpc_ent_t *); +typedef int (*lstcon_rpc_cond_func_t)(int, struct lstcon_node *, void *); +typedef int (*lstcon_rpc_readent_func_t)(int, srpc_msg_t *, lstcon_rpc_ent_t *); int lstcon_sesrpc_prep(struct lstcon_node *nd, int transop, unsigned version, lstcon_rpc_t **crpc); @@ -140,5 +140,4 @@ void lstcon_rpc_cleanup_wait(void); int lstcon_rpc_module_init(void); void lstcon_rpc_module_fini(void); - #endif diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index f47c8f27f..d315dd44a 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -40,7 +40,6 @@ * Author: Liang Zhen */ - #include "../../include/linux/libcfs/libcfs.h" #include "../../include/linux/lnet/lib-lnet.h" #include "console.h" @@ -308,7 +307,7 @@ lstcon_group_ndlink_release(lstcon_group_t *grp, lstcon_ndlink_t *ndl) { list_del_init(&ndl->ndl_link); lstcon_ndlink_release(ndl); - grp->grp_nnode --; + grp->grp_nnode--; } static void @@ -320,7 +319,7 @@ lstcon_group_ndlink_move(lstcon_group_t *old, list_del(&ndl->ndl_hlink); list_del(&ndl->ndl_link); - old->grp_nnode --; + old->grp_nnode--; list_add_tail(&ndl->ndl_hlink, &new->grp_ndl_hash[idx]); list_add_tail(&ndl->ndl_link, &new->grp_ndl_list); @@ -527,7 +526,7 @@ lstcon_group_add(char *name) lstcon_group_t *grp; int rc; - rc = (lstcon_group_find(name, &grp) == 0)? -EEXIST: 0; + rc = (lstcon_group_find(name, &grp) == 0) ? -EEXIST : 0; if (rc != 0) { /* find a group with same name */ lstcon_group_put(grp); @@ -816,7 +815,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp); rc = copy_to_user(gents_p, gentp, - sizeof(lstcon_ndlist_ent_t)) ? -EFAULT: 0; + sizeof(lstcon_ndlist_ent_t)) ? -EFAULT : 0; LIBCFS_FREE(gentp, sizeof(lstcon_ndlist_ent_t)); @@ -847,7 +846,7 @@ lstcon_batch_add(char *name) int i; int rc; - rc = (lstcon_batch_find(name, &bat) == 0)? -EEXIST: 0; + rc = (lstcon_batch_find(name, &bat) == 0) ? -EEXIST : 0; if (rc != 0) { CDEBUG(D_NET, "Batch %s already exists\n", name); return rc; @@ -911,7 +910,7 @@ lstcon_batch_list(int index, int len, char *name_up) list_for_each_entry(bat, &console_session.ses_bat_list, bat_link) { if (index-- == 0) { return copy_to_user(name_up, bat->bat_name, len) ? - -EFAULT: 0; + -EFAULT : 0; } } @@ -956,7 +955,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server, &test->tes_dst_grp->grp_ndl_list; if (dents_up != NULL) { - rc = lstcon_nodes_getent((server ? srvlst: clilst), + rc = lstcon_nodes_getent((server ? srvlst : clilst), index_p, ndent_p, dents_up); return rc; } @@ -1683,7 +1682,7 @@ int lstcon_session_match(lst_sid_t sid) { return (console_session.ses_id.ses_nid == sid.ses_nid && - console_session.ses_id.ses_stamp == sid.ses_stamp) ? 1: 0; + console_session.ses_id.ses_stamp == sid.ses_stamp) ? 1 : 0; } static void @@ -2004,7 +2003,7 @@ lstcon_console_init(void) 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); @@ -2021,7 +2020,6 @@ lstcon_console_init(void) for (i = 0; i < LST_GLOBAL_HASHSIZE; i++) INIT_LIST_HEAD(&console_session.ses_ndl_hash[i]); - /* initialize acceptor service table */ lstcon_init_acceptor_service(); diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index cdce2dd6b..3f3286c0c 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -43,7 +43,6 @@ #ifndef __LST_CONSOLE_H__ #define __LST_CONSOLE_H__ - #include "../../include/linux/libcfs/libcfs.h" #include "../../include/linux/lnet/lnet.h" #include "../../include/linux/lnet/lib-types.h" @@ -142,7 +141,7 @@ typedef struct { 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 */ diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 257de3537..f18e50036 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -170,8 +170,7 @@ sfw_add_session_timer(void) 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; } @@ -238,7 +237,6 @@ sfw_deactivate_session(void) spin_lock(&sfw_data.fw_lock); } - static void sfw_session_expired(void *data) { @@ -372,7 +370,6 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) sfw_session_t *sn = sfw_data.fw_session; sfw_counters_t *cnt = &reply->str_fw; sfw_batch_t *bat; - struct timeval tv; reply->str_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id; @@ -391,10 +388,7 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) /* send over the msecs since the session was started - with 32 bits to send, this is ~49 days */ - cfs_duration_usec(cfs_time_sub(cfs_time_current(), - sn->sn_started), &tv); - - cnt->running_ms = (__u32)(tv.tv_sec * 1000 + tv.tv_usec / 1000); + cnt->running_ms = jiffies_to_msecs(jiffies - sn->sn_started); cnt->brw_errors = atomic_read(&sn->sn_brw_errors); cnt->ping_errors = atomic_read(&sn->sn_ping_errors); cnt->zombie_sessions = atomic_read(&sfw_data.fw_nzombies); @@ -1638,7 +1632,6 @@ extern srpc_service_t brw_test_service; extern void brw_init_test_client(void); extern void brw_init_test_service(void); - int sfw_startup(void) { @@ -1648,7 +1641,6 @@ sfw_startup(void) srpc_service_t *sv; sfw_test_case_t *tsc; - if (session_timeout < 0) { CERROR("Session timeout must be non-negative: %d\n", session_timeout); diff --git a/drivers/staging/lustre/lnet/selftest/module.c b/drivers/staging/lustre/lnet/selftest/module.c index 09b8f4649..46cbdf045 100644 --- a/drivers/staging/lustre/lnet/selftest/module.c +++ b/drivers/staging/lustre/lnet/selftest/module.c @@ -150,7 +150,6 @@ error: return rc; } - MODULE_DESCRIPTION("LNet Selftest"); MODULE_LICENSE("GPL"); MODULE_VERSION("0.9.0"); diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index 1dab9984c..d42653654 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -92,7 +92,7 @@ ping_client_prep_rpc(sfw_test_unit_t *tsu, srpc_ping_reqst_t *req; sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_session_t *sn = tsi->tsi_batch->bat_session; - struct timeval tv; + struct timespec64 ts; int rc; LASSERT(sn != NULL); @@ -110,9 +110,9 @@ ping_client_prep_rpc(sfw_test_unit_t *tsu, req->pnr_seq = lst_ping_data.pnd_counter++; spin_unlock(&lst_ping_data.pnd_lock); - cfs_fs_timeval(&tv); - req->pnr_time_sec = tv.tv_sec; - req->pnr_time_usec = tv.tv_usec; + ktime_get_real_ts64(&ts); + req->pnr_time_sec = ts.tv_sec; + req->pnr_time_usec = ts.tv_nsec / NSEC_PER_USEC; return rc; } @@ -124,7 +124,7 @@ ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) sfw_session_t *sn = tsi->tsi_batch->bat_session; srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; - struct timeval tv; + struct timespec64 ts; LASSERT(sn != NULL); @@ -161,10 +161,10 @@ ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) return; } - cfs_fs_timeval(&tv); + ktime_get_real_ts64(&ts); CDEBUG(D_NET, "%d reply in %u usec\n", reply->pnr_seq, - (unsigned)((tv.tv_sec - (unsigned)reqst->pnr_time_sec) * 1000000 - + (tv.tv_usec - reqst->pnr_time_usec))); + (unsigned)((ts.tv_sec - reqst->pnr_time_sec) * 1000000 + + (ts.tv_nsec / NSEC_PER_USEC - reqst->pnr_time_usec))); return; } diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 6ae133138..7005002c1 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -146,7 +146,7 @@ srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink) int nob; pg = alloc_pages_node(cfs_cpt_spread_node(lnet_cpt_table(), cpt), - GFP_IOFS, 0); + GFP_KERNEL, 0); if (pg == NULL) { CERROR("Can't allocate page %d of %d\n", i, bulk_npg); srpc_free_bulk(bk); @@ -565,7 +565,7 @@ srpc_add_buffer(struct swi_workitem *wi) } 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); @@ -1100,8 +1100,7 @@ srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc) 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; } @@ -1355,7 +1354,6 @@ srpc_post_rpc(srpc_client_rpc_t *rpc) return; } - int srpc_send_reply(struct srpc_server_rpc *rpc) { @@ -1488,7 +1486,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) } 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; @@ -1581,7 +1579,6 @@ srpc_lnet_ev_handler(lnet_event_t *ev) } } - int srpc_startup(void) { @@ -1593,7 +1590,7 @@ srpc_startup(void) /* 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; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.h b/drivers/staging/lustre/lnet/selftest/rpc.h index b7b00c6b1..6b4a32a90 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.h +++ b/drivers/staging/lustre/lnet/selftest/rpc.h @@ -65,7 +65,6 @@ typedef enum { SRPC_MSG_JOIN_REPLY = 17, } srpc_msg_type_t; - /* CAVEAT EMPTOR: * All srpc_*_reqst_t's 1st field must be matchbits of reply buffer, * and 2nd field matchbits of bulk buffer if any. diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 7939e4e04..8a77d3fdf 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -56,7 +56,6 @@ #define MADE_WITHOUT_COMPROMISE #endif - #define SWI_STATE_NEWBORN 0 #define SWI_STATE_REPLY_SUBMITTED 1 #define SWI_STATE_REPLY_SENT 2 @@ -279,7 +278,7 @@ struct srpc_service_cd { /** 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 */ @@ -497,7 +496,6 @@ swi_deschedule_workitem(swi_workitem_t *swi) return cfs_wi_deschedule(swi->swi_sched, &swi->swi_workitem); } - int sfw_startup(void); int srpc_startup(void); void sfw_shutdown(void); @@ -562,17 +560,17 @@ static inline const char * swi_state2str (int state) { #define STATE2STR(x) case x: return #x - switch(state) { - default: - LBUG(); - STATE2STR(SWI_STATE_NEWBORN); - STATE2STR(SWI_STATE_REPLY_SUBMITTED); - STATE2STR(SWI_STATE_REPLY_SENT); - STATE2STR(SWI_STATE_REQUEST_SUBMITTED); - STATE2STR(SWI_STATE_REQUEST_SENT); - STATE2STR(SWI_STATE_REPLY_RECEIVED); - STATE2STR(SWI_STATE_BULK_STARTED); - STATE2STR(SWI_STATE_DONE); + switch (state) { + default: + LBUG(); + STATE2STR(SWI_STATE_NEWBORN); + STATE2STR(SWI_STATE_REPLY_SUBMITTED); + STATE2STR(SWI_STATE_REPLY_SENT); + STATE2STR(SWI_STATE_REQUEST_SUBMITTED); + STATE2STR(SWI_STATE_REQUEST_SENT); + STATE2STR(SWI_STATE_REPLY_RECEIVED); + STATE2STR(SWI_STATE_BULK_STARTED); + STATE2STR(SWI_STATE_DONE); } #undef STATE2STR } @@ -583,7 +581,6 @@ swi_state2str (int state) schedule_timeout(cfs_time_seconds(1) / 10); \ } while (0) - #define lst_wait_until(cond, lock, fmt, ...) \ do { \ int __I = 2; \ diff --git a/drivers/staging/lustre/lnet/selftest/timer.c b/drivers/staging/lustre/lnet/selftest/timer.c index 6133b54f4..b98c08a10 100644 --- a/drivers/staging/lustre/lnet/selftest/timer.c +++ b/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 @@ -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,7 +121,7 @@ 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; stt_timer_t *timer; @@ -130,7 +129,7 @@ stt_expire_list(struct list_head *slot, unsigned long now) 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); @@ -149,10 +148,10 @@ static int 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); @@ -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++) diff --git a/drivers/staging/lustre/lnet/selftest/timer.h b/drivers/staging/lustre/lnet/selftest/timer.h index 2a8803d89..03e2ee294 100644 --- a/drivers/staging/lustre/lnet/selftest/timer.h +++ b/drivers/staging/lustre/lnet/selftest/timer.h @@ -40,7 +40,7 @@ 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; -- cgit v1.2.3-54-g00ecf