Whamcloud - gitweb
LU-11300 lnet: remove lnd_query interface.
[fs/lustre-release.git] / lnet / klnds / o2iblnd / o2iblnd_cb.c
index e6c5e16..82c4509 100644 (file)
@@ -1051,8 +1051,7 @@ kiblnd_check_sends_locked(struct kib_conn *conn)
               !list_empty(&conn->ibc_tx_queue_rsrvd)) {
                tx = list_entry(conn->ibc_tx_queue_rsrvd.next,
                                struct kib_tx, tx_list);
-               list_del(&tx->tx_list);
-               list_add_tail(&tx->tx_list, &conn->ibc_tx_queue);
+               list_move_tail(&tx->tx_list, &conn->ibc_tx_queue);
                 conn->ibc_reserved_credits--;
         }
 
@@ -1465,12 +1464,10 @@ kiblnd_connect_peer(struct kib_peer_ni *peer_ni)
 bool
 kiblnd_reconnect_peer(struct kib_peer_ni *peer_ni)
 {
-       rwlock_t         *glock = &kiblnd_data.kib_global_lock;
-       char             *reason = NULL;
-       struct list_head  txs;
-       unsigned long     flags;
-
-       INIT_LIST_HEAD(&txs);
+       rwlock_t *glock = &kiblnd_data.kib_global_lock;
+       char *reason = NULL;
+       LIST_HEAD(txs);
+       unsigned long flags;
 
        write_lock_irqsave(glock, flags);
        if (peer_ni->ibp_reconnecting == 0) {
@@ -2151,7 +2148,7 @@ kiblnd_handle_early_rxs(struct kib_conn *conn)
 void
 kiblnd_abort_txs(struct kib_conn *conn, struct list_head *txs)
 {
-       struct list_head         zombies = LIST_HEAD_INIT(zombies);
+       LIST_HEAD(zombies);
        struct list_head        *tmp;
        struct list_head        *nxt;
        struct kib_tx *tx;
@@ -2196,8 +2193,7 @@ kiblnd_abort_txs(struct kib_conn *conn, struct list_head *txs)
                 */
                if (tx->tx_sending == 0) {
                        tx->tx_queued = 0;
-                       list_del(&tx->tx_list);
-                       list_add(&tx->tx_list, &zombies);
+                       list_move(&tx->tx_list, &zombies);
                }
        }
 
@@ -2241,7 +2237,7 @@ static void
 kiblnd_peer_connect_failed(struct kib_peer_ni *peer_ni, int active,
                           int error)
 {
-       struct list_head zombies = LIST_HEAD_INIT(zombies);
+       LIST_HEAD(zombies);
        unsigned long   flags;
 
        LASSERT (error != 0);
@@ -2297,7 +2293,7 @@ kiblnd_connreq_done(struct kib_conn *conn, int status)
 {
        struct kib_peer_ni *peer_ni = conn->ibc_peer;
        struct kib_tx *tx;
-       struct list_head txs;
+       LIST_HEAD(txs);
        unsigned long    flags;
        int              active;
 
@@ -2354,7 +2350,6 @@ kiblnd_connreq_done(struct kib_conn *conn, int status)
         }
 
        /* grab pending txs while I have the lock */
-       INIT_LIST_HEAD(&txs);
        list_splice_init(&peer_ni->ibp_tx_queue, &txs);
 
         if (!kiblnd_peer_active(peer_ni) ||        /* peer_ni has been deleted */
@@ -2756,11 +2751,12 @@ kiblnd_check_reconnect(struct kib_conn *conn, int version,
        }
 
        write_lock_irqsave(glock, flags);
-        /* retry connection if it's still needed and no other connection
-         * attempts (active or passive) are in progress
-         * NB: reconnect is still needed even when ibp_tx_queue is
-         * empty if ibp_version != version because reconnect may be
-         * initiated by kiblnd_query() */
+       /* retry connection if it's still needed and no other connection
+        * attempts (active or passive) are in progress
+        * NB: reconnect is still needed even when ibp_tx_queue is
+        * empty if ibp_version != version because reconnect may be
+        * initiated.
+        */
        reconnect = (!list_empty(&peer_ni->ibp_tx_queue) ||
                     peer_ni->ibp_version != version) &&
                    peer_ni->ibp_connecting &&
@@ -3369,9 +3365,9 @@ kiblnd_conn_timed_out_locked(struct kib_conn *conn)
 static void
 kiblnd_check_conns (int idx)
 {
-       struct list_head  closes = LIST_HEAD_INIT(closes);
-       struct list_head  checksends = LIST_HEAD_INIT(checksends);
-       struct list_head  timedout_txs = LIST_HEAD_INIT(timedout_txs);
+       LIST_HEAD(closes);
+       LIST_HEAD(checksends);
+       LIST_HEAD(timedout_txs);
        struct list_head *peers = &kiblnd_data.kib_peers[idx];
        struct list_head *ptmp;
        struct kib_peer_ni *peer_ni;