Commit 70513c5d authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

staging/lustre: use jiffies_to_*() instead of cfs_duration_usec

The cfs_duration_usec() function has a timeval as its output, which we
want to avoid in general because of the y2038 problem.

There are only two locations remaining in lustre, so we can for now
replace one with jiffies_to_timeval(), which is a generic kernel function
that does the same thing, the other can just use jiffies_to_usecs()
and completely avoid the timeval.

This is not a full solution yet, but it's a small step that lets us
build a larger portion of lustre without this reference to timeval in
a header file, and avoid triggering automated checking tools that wants
to warn about timeval.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e8453c24
...@@ -95,21 +95,6 @@ static inline long cfs_duration_sec(long d) ...@@ -95,21 +95,6 @@ static inline long cfs_duration_sec(long d)
return d / HZ; return d / HZ;
} }
static inline void cfs_duration_usec(long d, struct timeval *s)
{
#if (BITS_PER_LONG == 32) && (HZ > 4096)
__u64 t;
s->tv_sec = d / HZ;
t = (d - (long)s->tv_sec * HZ) * ONE_MILLION;
do_div(t, HZ);
s->tv_usec = t;
#else
s->tv_sec = d / HZ;
s->tv_usec = ((d - (long)s->tv_sec * HZ) * ONE_MILLION) / HZ;
#endif
}
#define cfs_time_current_64 get_jiffies_64 #define cfs_time_current_64 get_jiffies_64
static inline __u64 cfs_time_add_64(__u64 t, __u64 d) static inline __u64 cfs_time_add_64(__u64 t, __u64 d)
......
...@@ -505,7 +505,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, ...@@ -505,7 +505,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
dur = (long)cfs_time_sub(crpc->crp_stamp, dur = (long)cfs_time_sub(crpc->crp_stamp,
(unsigned long)console_session.ses_id.ses_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, if (copy_to_user(&ent->rpe_peer,
&nd->nd_id, sizeof(lnet_process_id_t)) || &nd->nd_id, sizeof(lnet_process_id_t)) ||
......
...@@ -372,7 +372,6 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) ...@@ -372,7 +372,6 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply)
sfw_session_t *sn = sfw_data.fw_session; sfw_session_t *sn = sfw_data.fw_session;
sfw_counters_t *cnt = &reply->str_fw; sfw_counters_t *cnt = &reply->str_fw;
sfw_batch_t *bat; sfw_batch_t *bat;
struct timeval tv;
reply->str_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id; reply->str_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id;
...@@ -391,10 +390,7 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) ...@@ -391,10 +390,7 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply)
/* send over the msecs since the session was started /* send over the msecs since the session was started
- with 32 bits to send, this is ~49 days */ - with 32 bits to send, this is ~49 days */
cfs_duration_usec(cfs_time_sub(cfs_time_current(), cnt->running_ms = jiffies_to_msecs(jiffies - sn->sn_started);
sn->sn_started), &tv);
cnt->running_ms = (__u32)(tv.tv_sec * 1000 + tv.tv_usec / 1000);
cnt->brw_errors = atomic_read(&sn->sn_brw_errors); cnt->brw_errors = atomic_read(&sn->sn_brw_errors);
cnt->ping_errors = atomic_read(&sn->sn_ping_errors); cnt->ping_errors = atomic_read(&sn->sn_ping_errors);
cnt->zombie_sessions = atomic_read(&sfw_data.fw_nzombies); cnt->zombie_sessions = atomic_read(&sfw_data.fw_nzombies);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment