staging/lustre: avoid unnecessary timeval conversion
authorArnd Bergmann <arnd@arndb.de>
Sun, 27 Sep 2015 20:45:09 +0000 (16:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 02:03:34 +0000 (04:03 +0200)
The lnet_eq_wait_locked tries to wait for time to pass or an event to
wake up the wait queue. The entire logic seems to be a very elaborate
reimplementation of wait_event().

I'm not trying to clean up the entire logic here, but this at least
gets rid of the multi-way conversion between miliseconds, timeval
and jiffies.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/lnet/lib-eq.c

index f19ce9ae6a9a3af47b0fe1f95255f1e43d922c9f..8b843c5e71a5eb0d0acd1522f736db025b0b3fc5 100644 (file)
@@ -341,12 +341,9 @@ __must_hold(&the_lnet.ln_eq_wait_lock)
                schedule();
 
        } else {
-               struct timeval tv;
-
-               now = cfs_time_current();
-               schedule_timeout(cfs_time_seconds(tms) / 1000);
-               cfs_duration_usec(cfs_time_sub(cfs_time_current(), now), &tv);
-               tms -= (int)(tv.tv_sec * 1000 + tv.tv_usec / 1000);
+               now = jiffies;
+               schedule_timeout(msecs_to_jiffies(tms));
+               tms -= jiffies_to_msecs(jiffies - now);
                if (tms < 0) /* no more wait but may have new event */
                        tms = 0;
        }