Whamcloud - gitweb
b=14300
authormaxim <maxim>
Tue, 25 Dec 2007 16:40:40 +0000 (16:40 +0000)
committermaxim <maxim>
Tue, 25 Dec 2007 16:40:40 +0000 (16:40 +0000)
i=isaac
i=liang
Fix for "prediction from the future" bug. Cleanup of gmlnd and qswlnd to ensure that they use cfs_time_t uniformly.

lnet/klnds/gmlnd/gmlnd.h
lnet/klnds/gmlnd/gmlnd_comm.c
lnet/klnds/qswlnd/qswlnd.h
lnet/klnds/qswlnd/qswlnd_cb.c
lnet/klnds/socklnd/socklnd.c

index be0f404..8373a73 100644 (file)
@@ -145,7 +145,8 @@ typedef struct gmnal_tx {
                 struct iovec    *iov;           /* mapped frags */
                 lnet_kiov_t     *kiov;          /* page frags */
         }                        tx_large_frags;
-        unsigned long            tx_launchtime; /* when (in jiffies) the transmit was launched */
+        cfs_time_t               tx_launchtime; /* when (in jiffies) the
+                                                 * transmit was launched */
         struct gmnal_tx         *tx_next;       /* stash on gmni_txs */
 } gmnal_tx_t;
 
index 4a66906..cb03c03 100644 (file)
 void
 gmnal_notify_peer_down(gmnal_tx_t *tx)
 {
-        struct timeval     now;
         time_t             then;
 
-        do_gettimeofday (&now);
-        then = now.tv_sec - (jiffies - tx->tx_launchtime)/HZ;
-
+        then = cfs_time_current_sec() -
+                cfs_duration_sec(cfs_time_current() -
+                                 tx->tx_launchtime);
+        
         lnet_notify(tx->tx_gmni->gmni_ni, tx->tx_nid, 0, then);
 }
 
@@ -339,7 +339,7 @@ gmnal_check_txqueues_locked (gmnal_ni_t *gmni)
                 LASSERT(!tx->tx_credit);
                 tx->tx_credit = 1;
 
-                tx->tx_launchtime = jiffies;
+                tx->tx_launchtime = cfs_time_current();
 
                 if (tx->tx_msgnob <= gmni->gmni_small_msgsize) {
                         LASSERT (tx->tx_ltxb == NULL);
index ba08e16..bf3adc5 100644 (file)
@@ -205,7 +205,8 @@ typedef struct kqswnal_tx
         lnet_nid_t        ktx_nid;              /* destination node */
         void             *ktx_args[3];          /* completion passthru */
         char             *ktx_buffer;           /* pre-allocated contiguous buffer for hdr + small payloads */
-        unsigned long     ktx_launchtime;       /* when (in jiffies) the transmit was launched */
+        cfs_time_t        ktx_launchtime;       /*  when (in jiffies) the transmit
+                                                 *  was launched */
         int               ktx_status;           /* completion status */
 #if KQSW_CKSUM
         __u32             ktx_cksum;            /* optimized GET payload checksum */
index eaa890e..c509d10 100644 (file)
 void
 kqswnal_notify_peer_down(kqswnal_tx_t *ktx)
 {
-        struct timeval     now;
         time_t             then;
 
-        do_gettimeofday (&now);
-        then = now.tv_sec - (jiffies - ktx->ktx_launchtime)/HZ;
+        then = cfs_time_current_sec() -
+                cfs_duration_sec(cfs_time_current() -
+                                 ktx->ktx_launchtime);
 
         lnet_notify(kqswnal_data.kqn_ni, ktx->ktx_nid, 0, then);
 }
@@ -607,7 +607,7 @@ kqswnal_launch (kqswnal_tx_t *ktx)
         unsigned long flags;
         int   rc;
 
-        ktx->ktx_launchtime = jiffies;
+        ktx->ktx_launchtime = cfs_time_current();
 
         if (kqswnal_data.kqn_shuttingdown)
                 return (-ESHUTDOWN);
index fc105f3..00a260a 100644 (file)
@@ -1464,7 +1464,9 @@ ksocknal_peer_failed (ksock_peer_t *peer)
             peer->ksnp_accepting == 0 &&
             ksocknal_find_connecting_route_locked(peer) == NULL) {
                 notify = 1;
-                last_alive = cfs_time_seconds(peer->ksnp_last_alive);
+                last_alive = cfs_time_current_sec() -
+                        cfs_duration_sec(cfs_time_current() -
+                                         peer->ksnp_last_alive);
         }
         
         read_unlock (&ksocknal_data.ksnd_global_lock);