Whamcloud - gitweb
LU-3963 libcfs: convert LNET layer to linux list api
[fs/lustre-release.git] / lnet / klnds / socklnd / socklnd_cb.c
index 9db13f8..515b22f 100644 (file)
@@ -37,11 +37,11 @@ ksocknal_alloc_tx(int type, int size)
                /* searching for a noop tx in free list */
                spin_lock(&ksocknal_data.ksnd_tx_lock);
 
-               if (!cfs_list_empty(&ksocknal_data.ksnd_idle_noop_txs)) {
-                       tx = cfs_list_entry(ksocknal_data.ksnd_idle_noop_txs. \
+               if (!list_empty(&ksocknal_data.ksnd_idle_noop_txs)) {
+                       tx = list_entry(ksocknal_data.ksnd_idle_noop_txs. \
                                            next, ksock_tx_t, tx_list);
                        LASSERT(tx->tx_desc_size == size);
-                       cfs_list_del(&tx->tx_list);
+                       list_del(&tx->tx_list);
                }
 
                spin_unlock(&ksocknal_data.ksnd_tx_lock);
@@ -99,7 +99,7 @@ ksocknal_free_tx (ksock_tx_t *tx)
                /* it's a noop tx */
                spin_lock(&ksocknal_data.ksnd_tx_lock);
 
-               cfs_list_add(&tx->tx_list, &ksocknal_data.ksnd_idle_noop_txs);
+               list_add(&tx->tx_list, &ksocknal_data.ksnd_idle_noop_txs);
 
                spin_unlock(&ksocknal_data.ksnd_tx_lock);
        } else {
@@ -407,12 +407,12 @@ ksocknal_tx_done (lnet_ni_t *ni, ksock_tx_t *tx)
 }
 
 void
-ksocknal_txlist_done (lnet_ni_t *ni, cfs_list_t *txlist, int error)
+ksocknal_txlist_done(lnet_ni_t *ni, struct list_head *txlist, int error)
 {
         ksock_tx_t *tx;
 
-        while (!cfs_list_empty (txlist)) {
-                tx = cfs_list_entry (txlist->next, ksock_tx_t, tx_list);
+       while (!list_empty(txlist)) {
+               tx = list_entry(txlist->next, ksock_tx_t, tx_list);
 
                 if (error && tx->tx_lnetmsg != NULL) {
                         CNETERR("Deleting packet type %d len %d %s->%s\n",
@@ -424,7 +424,7 @@ ksocknal_txlist_done (lnet_ni_t *ni, cfs_list_t *txlist, int error)
                         CNETERR("Deleting noop packet\n");
                 }
 
-                cfs_list_del (&tx->tx_list);
+               list_del(&tx->tx_list);
 
                LASSERT (atomic_read(&tx->tx_refcount) == 1);
                 ksocknal_tx_done (ni, tx);
@@ -470,7 +470,7 @@ ksocknal_check_zc_req(ksock_tx_t *tx)
         if (peer->ksnp_zc_next_cookie == 0)
                 peer->ksnp_zc_next_cookie = SOCKNAL_KEEPALIVE_PING + 1;
 
-        cfs_list_add_tail(&tx->tx_zc_list, &peer->ksnp_zc_req_list);
+       list_add_tail(&tx->tx_zc_list, &peer->ksnp_zc_req_list);
 
        spin_unlock(&peer->ksnp_lock);
 }
@@ -494,7 +494,7 @@ ksocknal_uncheck_zc_req(ksock_tx_t *tx)
        }
 
        tx->tx_msg.ksm_zc_cookies[0] = 0;
-       cfs_list_del(&tx->tx_zc_list);
+       list_del(&tx->tx_zc_list);
 
        spin_unlock(&peer->ksnp_lock);
 
@@ -536,7 +536,7 @@ ksocknal_process_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
 
                 /* enomem list takes over scheduler's ref... */
                 LASSERT (conn->ksnc_tx_scheduled);
-                cfs_list_add_tail(&conn->ksnc_tx_list,
+               list_add_tail(&conn->ksnc_tx_list,
                                   &ksocknal_data.ksnd_enomem_conns);
                if (!cfs_time_aftereq(cfs_time_add(cfs_time_current(),
                                        SOCKNAL_ENOMEM_RETRY),
@@ -596,7 +596,7 @@ ksocknal_launch_connection_locked (ksock_route_t *route)
 
        spin_lock_bh(&ksocknal_data.ksnd_connd_lock);
 
-       cfs_list_add_tail(&route->ksnr_connd_list,
+       list_add_tail(&route->ksnr_connd_list,
                          &ksocknal_data.ksnd_connd_routes);
        wake_up(&ksocknal_data.ksnd_connd_waitq);
 
@@ -622,15 +622,15 @@ ksocknal_launch_all_connections_locked (ksock_peer_t *peer)
 ksock_conn_t *
 ksocknal_find_conn_locked(ksock_peer_t *peer, ksock_tx_t *tx, int nonblk)
 {
-        cfs_list_t       *tmp;
+       struct list_head *tmp;
         ksock_conn_t     *conn;
         ksock_conn_t     *typed = NULL;
         ksock_conn_t     *fallback = NULL;
         int               tnob     = 0;
         int               fnob     = 0;
 
-        cfs_list_for_each (tmp, &peer->ksnp_conns) {
-                ksock_conn_t *c  = cfs_list_entry(tmp, ksock_conn_t, ksnc_list);
+       list_for_each(tmp, &peer->ksnp_conns) {
+               ksock_conn_t *c  = list_entry(tmp, ksock_conn_t, ksnc_list);
                int           nob = atomic_read(&c->ksnc_tx_nob) +
                                     libcfs_sock_wmem_queued(c->ksnc_sock);
                 int           rc;
@@ -731,7 +731,7 @@ ksocknal_queue_tx_locked (ksock_tx_t *tx, ksock_conn_t *conn)
         bufnob = libcfs_sock_wmem_queued(conn->ksnc_sock);
        spin_lock_bh(&sched->kss_lock);
 
-       if (cfs_list_empty(&conn->ksnc_tx_queue) && bufnob == 0) {
+       if (list_empty(&conn->ksnc_tx_queue) && bufnob == 0) {
                /* First packet starts the timeout */
                conn->ksnc_tx_deadline =
                        cfs_time_shift(*ksocknal_tunables.ksnd_timeout);
@@ -762,14 +762,14 @@ ksocknal_queue_tx_locked (ksock_tx_t *tx, ksock_conn_t *conn)
 
         if (ztx != NULL) {
                atomic_sub (ztx->tx_nob, &conn->ksnc_tx_nob);
-                cfs_list_add_tail(&ztx->tx_list, &sched->kss_zombie_noop_txs);
+               list_add_tail(&ztx->tx_list, &sched->kss_zombie_noop_txs);
         }
 
        if (conn->ksnc_tx_ready &&      /* able to send */
            !conn->ksnc_tx_scheduled) { /* not scheduled to send */
                /* +1 ref for scheduler */
                ksocknal_conn_addref(conn);
-               cfs_list_add_tail (&conn->ksnc_tx_list,
+               list_add_tail(&conn->ksnc_tx_list,
                                   &sched->kss_tx_conns);
                conn->ksnc_tx_scheduled = 1;
                wake_up(&sched->kss_waitq);
@@ -783,11 +783,11 @@ ksock_route_t *
 ksocknal_find_connectable_route_locked (ksock_peer_t *peer)
 {
         cfs_time_t     now = cfs_time_current();
-        cfs_list_t    *tmp;
+       struct list_head    *tmp;
         ksock_route_t *route;
 
-        cfs_list_for_each (tmp, &peer->ksnp_routes) {
-                route = cfs_list_entry (tmp, ksock_route_t, ksnr_list);
+       list_for_each(tmp, &peer->ksnp_routes) {
+               route = list_entry(tmp, ksock_route_t, ksnr_list);
 
                 LASSERT (!route->ksnr_connecting || route->ksnr_scheduled);
 
@@ -819,11 +819,11 @@ ksocknal_find_connectable_route_locked (ksock_peer_t *peer)
 ksock_route_t *
 ksocknal_find_connecting_route_locked (ksock_peer_t *peer)
 {
-        cfs_list_t        *tmp;
+       struct list_head        *tmp;
         ksock_route_t     *route;
 
-        cfs_list_for_each (tmp, &peer->ksnp_routes) {
-                route = cfs_list_entry (tmp, ksock_route_t, ksnr_list);
+       list_for_each(tmp, &peer->ksnp_routes) {
+               route = list_entry(tmp, ksock_route_t, ksnr_list);
 
                 LASSERT (!route->ksnr_connecting || route->ksnr_scheduled);
 
@@ -913,7 +913,7 @@ ksocknal_launch_packet (lnet_ni_t *ni, ksock_tx_t *tx, lnet_process_id_t id)
                         cfs_time_shift(*ksocknal_tunables.ksnd_timeout);
 
                 /* Queue the message until a connection is established */
-                cfs_list_add_tail (&tx->tx_list, &peer->ksnp_tx_queue);
+               list_add_tail(&tx->tx_list, &peer->ksnp_tx_queue);
                write_unlock_bh(g_lock);
                 return 0;
         }
@@ -1357,7 +1357,7 @@ ksocknal_recv (lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed,
 
        switch (conn->ksnc_rx_state) {
        case SOCKNAL_RX_PARSE_WAIT:
-               cfs_list_add_tail(&conn->ksnc_rx_list, &sched->kss_rx_conns);
+               list_add_tail(&conn->ksnc_rx_list, &sched->kss_rx_conns);
                wake_up(&sched->kss_waitq);
                LASSERT(conn->ksnc_rx_ready);
                break;
@@ -1382,8 +1382,8 @@ ksocknal_sched_cansleep(ksock_sched_t *sched)
        spin_lock_bh(&sched->kss_lock);
 
        rc = (!ksocknal_data.ksnd_shuttingdown &&
-             cfs_list_empty(&sched->kss_rx_conns) &&
-             cfs_list_empty(&sched->kss_tx_conns));
+             list_empty(&sched->kss_rx_conns) &&
+             list_empty(&sched->kss_tx_conns));
 
        spin_unlock_bh(&sched->kss_lock);
        return rc;
@@ -1417,10 +1417,10 @@ int ksocknal_scheduler(void *arg)
 
                 /* Ensure I progress everything semi-fairly */
 
-                if (!cfs_list_empty (&sched->kss_rx_conns)) {
-                        conn = cfs_list_entry(sched->kss_rx_conns.next,
+               if (!list_empty(&sched->kss_rx_conns)) {
+                       conn = list_entry(sched->kss_rx_conns.next,
                                               ksock_conn_t, ksnc_rx_list);
-                        cfs_list_del(&conn->ksnc_rx_list);
+                       list_del(&conn->ksnc_rx_list);
 
                         LASSERT(conn->ksnc_rx_scheduled);
                         LASSERT(conn->ksnc_rx_ready);
@@ -1450,7 +1450,7 @@ int ksocknal_scheduler(void *arg)
                                 conn->ksnc_rx_state = SOCKNAL_RX_PARSE_WAIT;
                         } else if (conn->ksnc_rx_ready) {
                                 /* reschedule for rx */
-                                cfs_list_add_tail (&conn->ksnc_rx_list,
+                               list_add_tail(&conn->ksnc_rx_list,
                                                    &sched->kss_rx_conns);
                         } else {
                                 conn->ksnc_rx_scheduled = 0;
@@ -1461,31 +1461,31 @@ int ksocknal_scheduler(void *arg)
                         did_something = 1;
                 }
 
-                if (!cfs_list_empty (&sched->kss_tx_conns)) {
-                        CFS_LIST_HEAD    (zlist);
+               if (!list_empty(&sched->kss_tx_conns)) {
+                       struct list_head zlist = LIST_HEAD_INIT(zlist);
 
-                        if (!cfs_list_empty(&sched->kss_zombie_noop_txs)) {
-                                cfs_list_add(&zlist,
+                       if (!list_empty(&sched->kss_zombie_noop_txs)) {
+                               list_add(&zlist,
                                              &sched->kss_zombie_noop_txs);
-                                cfs_list_del_init(&sched->kss_zombie_noop_txs);
+                               list_del_init(&sched->kss_zombie_noop_txs);
                         }
 
-                        conn = cfs_list_entry(sched->kss_tx_conns.next,
+                       conn = list_entry(sched->kss_tx_conns.next,
                                               ksock_conn_t, ksnc_tx_list);
-                        cfs_list_del (&conn->ksnc_tx_list);
+                       list_del(&conn->ksnc_tx_list);
 
                         LASSERT(conn->ksnc_tx_scheduled);
                         LASSERT(conn->ksnc_tx_ready);
-                        LASSERT(!cfs_list_empty(&conn->ksnc_tx_queue));
+                       LASSERT(!list_empty(&conn->ksnc_tx_queue));
 
-                        tx = cfs_list_entry(conn->ksnc_tx_queue.next,
+                       tx = list_entry(conn->ksnc_tx_queue.next,
                                             ksock_tx_t, tx_list);
 
                         if (conn->ksnc_tx_carrier == tx)
                                 ksocknal_next_tx_carrier(conn);
 
                         /* dequeue now so empty list => more to send */
-                        cfs_list_del(&tx->tx_list);
+                       list_del(&tx->tx_list);
 
                         /* Clear tx_ready in case send isn't complete.  Do
                          * it BEFORE we call process_transmit, since
@@ -1494,7 +1494,7 @@ int ksocknal_scheduler(void *arg)
                         conn->ksnc_tx_ready = 0;
                        spin_unlock_bh(&sched->kss_lock);
 
-                        if (!cfs_list_empty(&zlist)) {
+                       if (!list_empty(&zlist)) {
                                 /* free zombie noop txs, it's fast because 
                                  * noop txs are just put in freelist */
                                 ksocknal_txlist_done(NULL, &zlist, 0);
@@ -1505,7 +1505,7 @@ int ksocknal_scheduler(void *arg)
                         if (rc == -ENOMEM || rc == -EAGAIN) {
                                 /* Incomplete send: replace tx on HEAD of tx_queue */
                                spin_lock_bh(&sched->kss_lock);
-                               cfs_list_add(&tx->tx_list,
+                               list_add(&tx->tx_list,
                                             &conn->ksnc_tx_queue);
                        } else {
                                /* Complete send; tx -ref */
@@ -1520,9 +1520,9 @@ int ksocknal_scheduler(void *arg)
                                 /* Do nothing; after a short timeout, this
                                  * conn will be reposted on kss_tx_conns. */
                         } else if (conn->ksnc_tx_ready &&
-                                   !cfs_list_empty (&conn->ksnc_tx_queue)) {
+                                  !list_empty(&conn->ksnc_tx_queue)) {
                                 /* reschedule for tx */
-                                cfs_list_add_tail (&conn->ksnc_tx_list,
+                               list_add_tail(&conn->ksnc_tx_list,
                                                    &sched->kss_tx_conns);
                         } else {
                                 conn->ksnc_tx_scheduled = 0;
@@ -1572,7 +1572,7 @@ void ksocknal_read_callback (ksock_conn_t *conn)
        conn->ksnc_rx_ready = 1;
 
        if (!conn->ksnc_rx_scheduled) {  /* not being progressed */
-               cfs_list_add_tail(&conn->ksnc_rx_list,
+               list_add_tail(&conn->ksnc_rx_list,
                                  &sched->kss_rx_conns);
                conn->ksnc_rx_scheduled = 1;
                /* extra ref for scheduler */
@@ -1600,9 +1600,9 @@ void ksocknal_write_callback(ksock_conn_t *conn)
 
        conn->ksnc_tx_ready = 1;
 
-       if (!conn->ksnc_tx_scheduled && // not being progressed
-           !cfs_list_empty(&conn->ksnc_tx_queue)){//packets to send
-               cfs_list_add_tail(&conn->ksnc_tx_list, &sched->kss_tx_conns);
+       if (!conn->ksnc_tx_scheduled && /* not being progressed */
+           !list_empty(&conn->ksnc_tx_queue)) { /* packets to send */
+               list_add_tail(&conn->ksnc_tx_list, &sched->kss_tx_conns);
                conn->ksnc_tx_scheduled = 1;
                /* extra ref for scheduler */
                ksocknal_conn_addref(conn);
@@ -1847,7 +1847,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,
 int
 ksocknal_connect (ksock_route_t *route)
 {
-        CFS_LIST_HEAD    (zombies);
+       struct list_head        zombies = LIST_HEAD_INIT(zombies);
         ksock_peer_t     *peer = route->ksnr_peer;
         int               type;
         int               wanted;
@@ -1977,29 +1977,29 @@ ksocknal_connect (ksock_route_t *route)
         route->ksnr_timeout = cfs_time_add(cfs_time_current(),
                                            route->ksnr_retry_interval);
 
-        if (!cfs_list_empty(&peer->ksnp_tx_queue) &&
+       if (!list_empty(&peer->ksnp_tx_queue) &&
             peer->ksnp_accepting == 0 &&
             ksocknal_find_connecting_route_locked(peer) == NULL) {
                 ksock_conn_t *conn;
 
                 /* ksnp_tx_queue is queued on a conn on successful
                  * connection for V1.x and V2.x */
-                if (!cfs_list_empty (&peer->ksnp_conns)) {
-                        conn = cfs_list_entry(peer->ksnp_conns.next,
+               if (!list_empty(&peer->ksnp_conns)) {
+                       conn = list_entry(peer->ksnp_conns.next,
                                               ksock_conn_t, ksnc_list);
                         LASSERT (conn->ksnc_proto == &ksocknal_protocol_v3x);
                 }
 
                 /* take all the blocked packets while I've got the lock and
                  * complete below... */
-                cfs_list_splice_init(&peer->ksnp_tx_queue, &zombies);
+               list_splice_init(&peer->ksnp_tx_queue, &zombies);
         }
 
 #if 0           /* irrelevent with only eager routes */
         if (!route->ksnr_deleted) {
                 /* make this route least-favourite for re-selection */
-                cfs_list_del(&route->ksnr_list);
-                cfs_list_add_tail(&route->ksnr_list, &peer->ksnp_routes);
+               list_del(&route->ksnr_list);
+               list_add_tail(&route->ksnr_list, &peer->ksnp_routes);
         }
 #endif
        write_unlock_bh(&ksocknal_data.ksnd_global_lock);
@@ -2123,7 +2123,7 @@ ksocknal_connd_get_route_locked(signed long *timeout_p)
        now = cfs_time_current();
 
        /* connd_routes can contain both pending and ordinary routes */
-       cfs_list_for_each_entry (route, &ksocknal_data.ksnd_connd_routes,
+       list_for_each_entry(route, &ksocknal_data.ksnd_connd_routes,
                                 ksnr_connd_list) {
 
                if (route->ksnr_retry_interval == 0 ||
@@ -2174,12 +2174,12 @@ ksocknal_connd (void *arg)
                         dropped_lock = 1;
                 }
 
-                if (!cfs_list_empty(&ksocknal_data.ksnd_connd_connreqs)) {
+               if (!list_empty(&ksocknal_data.ksnd_connd_connreqs)) {
                         /* Connection accepted by the listener */
-                        cr = cfs_list_entry(ksocknal_data.ksnd_connd_connreqs. \
+                       cr = list_entry(ksocknal_data.ksnd_connd_connreqs. \
                                             next, ksock_connreq_t, ksncr_list);
 
-                        cfs_list_del(&cr->ksncr_list);
+                       list_del(&cr->ksncr_list);
                        spin_unlock_bh(connd_lock);
                        dropped_lock = 1;
 
@@ -2199,7 +2199,7 @@ ksocknal_connd (void *arg)
                         route = ksocknal_connd_get_route_locked(&timeout);
                 }
                 if (route != NULL) {
-                        cfs_list_del (&route->ksnr_connd_list);
+                       list_del(&route->ksnr_connd_list);
                         ksocknal_data.ksnd_connd_connecting++;
                        spin_unlock_bh(connd_lock);
                         dropped_lock = 1;
@@ -2256,11 +2256,11 @@ ksocknal_find_timed_out_conn (ksock_peer_t *peer)
 {
         /* We're called with a shared lock on ksnd_global_lock */
         ksock_conn_t      *conn;
-        cfs_list_t        *ctmp;
+       struct list_head        *ctmp;
 
-        cfs_list_for_each (ctmp, &peer->ksnp_conns) {
+       list_for_each(ctmp, &peer->ksnp_conns) {
                 int     error;
-                conn = cfs_list_entry (ctmp, ksock_conn_t, ksnc_list);
+               conn = list_entry(ctmp, ksock_conn_t, ksnc_list);
 
                 /* Don't need the {get,put}connsock dance to deref ksnc_sock */
                 LASSERT (!conn->ksnc_closing);
@@ -2317,7 +2317,7 @@ ksocknal_find_timed_out_conn (ksock_peer_t *peer)
                         return (conn);
                 }
 
-                if ((!cfs_list_empty(&conn->ksnc_tx_queue) ||
+               if ((!list_empty(&conn->ksnc_tx_queue) ||
                      libcfs_sock_wmem_queued(conn->ksnc_sock) != 0) &&
                     cfs_time_aftereq(cfs_time_current(),
                                      conn->ksnc_tx_deadline)) {
@@ -2340,20 +2340,20 @@ static inline void
 ksocknal_flush_stale_txs(ksock_peer_t *peer)
 {
         ksock_tx_t        *tx;
-        CFS_LIST_HEAD      (stale_txs);
+       struct list_head        stale_txs = LIST_HEAD_INIT(stale_txs);
 
        write_lock_bh(&ksocknal_data.ksnd_global_lock);
 
-        while (!cfs_list_empty (&peer->ksnp_tx_queue)) {
-                tx = cfs_list_entry (peer->ksnp_tx_queue.next,
+       while (!list_empty(&peer->ksnp_tx_queue)) {
+               tx = list_entry(peer->ksnp_tx_queue.next,
                                      ksock_tx_t, tx_list);
 
                 if (!cfs_time_aftereq(cfs_time_current(),
                                       tx->tx_deadline))
                         break;
 
-                cfs_list_del (&tx->tx_list);
-                cfs_list_add_tail (&tx->tx_list, &stale_txs);
+               list_del(&tx->tx_list);
+               list_add_tail(&tx->tx_list, &stale_txs);
         }
 
        write_unlock_bh(&ksocknal_data.ksnd_global_lock);
@@ -2368,7 +2368,8 @@ ksocknal_send_keepalive_locked(ksock_peer_t *peer)
         ksock_conn_t   *conn;
         ksock_tx_t     *tx;
 
-        if (cfs_list_empty(&peer->ksnp_conns)) /* last_alive will be updated by create_conn */
+       /* last_alive will be updated by create_conn */
+       if (list_empty(&peer->ksnp_conns))
                 return 0;
 
         if (peer->ksnp_proto != &ksocknal_protocol_v3x)
@@ -2393,7 +2394,7 @@ ksocknal_send_keepalive_locked(ksock_peer_t *peer)
                 sched = conn->ksnc_scheduler;
 
                spin_lock_bh(&sched->kss_lock);
-               if (!cfs_list_empty(&conn->ksnc_tx_queue)) {
+               if (!list_empty(&conn->ksnc_tx_queue)) {
                        spin_unlock_bh(&sched->kss_lock);
                        /* there is an queued ACK, don't need keepalive */
                        return 0;
@@ -2426,7 +2427,7 @@ ksocknal_send_keepalive_locked(ksock_peer_t *peer)
 void
 ksocknal_check_peer_timeouts (int idx)
 {
-        cfs_list_t       *peers = &ksocknal_data.ksnd_peers[idx];
+       struct list_head       *peers = &ksocknal_data.ksnd_peers[idx];
         ksock_peer_t     *peer;
         ksock_conn_t     *conn;
         ksock_tx_t       *tx;
@@ -2437,7 +2438,7 @@ ksocknal_check_peer_timeouts (int idx)
          * take a look... */
        read_lock(&ksocknal_data.ksnd_global_lock);
 
-        cfs_list_for_each_entry_typed(peer, peers, ksock_peer_t, ksnp_list) {
+       list_for_each_entry(peer, peers, ksnp_list) {
                 cfs_time_t  deadline = 0;
                 int         resid = 0;
                 int         n     = 0;
@@ -2463,9 +2464,9 @@ ksocknal_check_peer_timeouts (int idx)
 
                 /* we can't process stale txs right here because we're
                  * holding only shared lock */
-                if (!cfs_list_empty (&peer->ksnp_tx_queue)) {
+               if (!list_empty(&peer->ksnp_tx_queue)) {
                         ksock_tx_t *tx =
-                                cfs_list_entry (peer->ksnp_tx_queue.next,
+                               list_entry(peer->ksnp_tx_queue.next,
                                                 ksock_tx_t, tx_list);
 
                         if (cfs_time_aftereq(cfs_time_current(),
@@ -2481,12 +2482,11 @@ ksocknal_check_peer_timeouts (int idx)
                         }
                 }
 
-                if (cfs_list_empty(&peer->ksnp_zc_req_list))
+               if (list_empty(&peer->ksnp_zc_req_list))
                         continue;
 
                spin_lock(&peer->ksnp_lock);
-                cfs_list_for_each_entry_typed(tx, &peer->ksnp_zc_req_list,
-                                              ksock_tx_t, tx_zc_list) {
+               list_for_each_entry(tx, &peer->ksnp_zc_req_list, tx_zc_list) {
                         if (!cfs_time_aftereq(cfs_time_current(),
                                               tx->tx_deadline))
                                 break;
@@ -2501,7 +2501,7 @@ ksocknal_check_peer_timeouts (int idx)
                         continue;
                 }
 
-                tx = cfs_list_entry(peer->ksnp_zc_req_list.next,
+               tx = list_entry(peer->ksnp_zc_req_list.next,
                                     ksock_tx_t, tx_zc_list);
                 deadline = tx->tx_deadline;
                 resid    = tx->tx_resid;
@@ -2531,7 +2531,7 @@ int ksocknal_reaper(void *arg)
        wait_queue_t     wait;
        ksock_conn_t      *conn;
        ksock_sched_t     *sched;
-       cfs_list_t         enomem_conns;
+       struct list_head         enomem_conns;
         int                nenomem_conns;
         cfs_duration_t     timeout;
         int                i;
@@ -2540,18 +2540,18 @@ int ksocknal_reaper(void *arg)
 
         cfs_block_allsigs ();
 
-       CFS_INIT_LIST_HEAD(&enomem_conns);
+       INIT_LIST_HEAD(&enomem_conns);
        init_waitqueue_entry_current(&wait);
 
        spin_lock_bh(&ksocknal_data.ksnd_reaper_lock);
 
         while (!ksocknal_data.ksnd_shuttingdown) {
 
-                if (!cfs_list_empty (&ksocknal_data.ksnd_deathrow_conns)) {
-                        conn = cfs_list_entry (ksocknal_data. \
+               if (!list_empty(&ksocknal_data.ksnd_deathrow_conns)) {
+                       conn = list_entry(ksocknal_data. \
                                                ksnd_deathrow_conns.next,
                                                ksock_conn_t, ksnc_list);
-                        cfs_list_del (&conn->ksnc_list);
+                       list_del(&conn->ksnc_list);
 
                        spin_unlock_bh(&ksocknal_data.ksnd_reaper_lock);
 
@@ -2562,10 +2562,10 @@ int ksocknal_reaper(void *arg)
                         continue;
                 }
 
-                if (!cfs_list_empty (&ksocknal_data.ksnd_zombie_conns)) {
-                        conn = cfs_list_entry (ksocknal_data.ksnd_zombie_conns.\
+               if (!list_empty(&ksocknal_data.ksnd_zombie_conns)) {
+                       conn = list_entry(ksocknal_data.ksnd_zombie_conns.\
                                                next, ksock_conn_t, ksnc_list);
-                        cfs_list_del (&conn->ksnc_list);
+                       list_del(&conn->ksnc_list);
 
                        spin_unlock_bh(&ksocknal_data.ksnd_reaper_lock);
 
@@ -2575,20 +2575,20 @@ int ksocknal_reaper(void *arg)
                         continue;
                 }
 
-                if (!cfs_list_empty (&ksocknal_data.ksnd_enomem_conns)) {
-                        cfs_list_add(&enomem_conns,
+               if (!list_empty(&ksocknal_data.ksnd_enomem_conns)) {
+                       list_add(&enomem_conns,
                                      &ksocknal_data.ksnd_enomem_conns);
-                        cfs_list_del_init(&ksocknal_data.ksnd_enomem_conns);
+                       list_del_init(&ksocknal_data.ksnd_enomem_conns);
                 }
 
                spin_unlock_bh(&ksocknal_data.ksnd_reaper_lock);
 
                 /* reschedule all the connections that stalled with ENOMEM... */
                 nenomem_conns = 0;
-                while (!cfs_list_empty (&enomem_conns)) {
-                        conn = cfs_list_entry (enomem_conns.next,
+               while (!list_empty(&enomem_conns)) {
+                       conn = list_entry(enomem_conns.next,
                                                ksock_conn_t, ksnc_tx_list);
-                        cfs_list_del (&conn->ksnc_tx_list);
+                       list_del(&conn->ksnc_tx_list);
 
                         sched = conn->ksnc_scheduler;
 
@@ -2596,7 +2596,7 @@ int ksocknal_reaper(void *arg)
 
                        LASSERT(conn->ksnc_tx_scheduled);
                        conn->ksnc_tx_ready = 1;
-                       cfs_list_add_tail(&conn->ksnc_tx_list,
+                       list_add_tail(&conn->ksnc_tx_list,
                                          &sched->kss_tx_conns);
                        wake_up(&sched->kss_waitq);
 
@@ -2646,8 +2646,8 @@ int ksocknal_reaper(void *arg)
                add_wait_queue(&ksocknal_data.ksnd_reaper_waitq, &wait);
 
                if (!ksocknal_data.ksnd_shuttingdown &&
-                   cfs_list_empty(&ksocknal_data.ksnd_deathrow_conns) &&
-                   cfs_list_empty(&ksocknal_data.ksnd_zombie_conns))
+                   list_empty(&ksocknal_data.ksnd_deathrow_conns) &&
+                   list_empty(&ksocknal_data.ksnd_zombie_conns))
                        waitq_timedwait(&wait, TASK_INTERRUPTIBLE, timeout);
 
                set_current_state(TASK_RUNNING);