Whamcloud - gitweb
LU-7988 hsm: only browse entries of hsd.request when needed
[fs/lustre-release.git] / lnet / lnet / lib-msg.c
index 26bd68b..d21a1d6 100644 (file)
@@ -43,7 +43,7 @@
 #include <lnet/lib-lnet.h>
 
 void
-lnet_build_unlink_event (lnet_libmd_t *md, lnet_event_t *ev)
+lnet_build_unlink_event(lnet_libmd_t *md, lnet_event_t *ev)
 {
         ENTRY;
 
@@ -365,7 +365,7 @@ lnet_complete_msg_locked(lnet_msg_t *msg, int cpt)
         int                rc;
         int                status = msg->msg_ev.status;
 
-        LASSERT (msg->msg_onactivelist);
+       LASSERT(msg->msg_onactivelist);
 
         if (status == 0 && msg->msg_ack) {
                 /* Only send an ACK if the PUT completed successfully */
@@ -430,12 +430,12 @@ lnet_complete_msg_locked(lnet_msg_t *msg, int cpt)
        }
 
        lnet_msg_decommit(msg, cpt, status);
-       lnet_msg_free_locked(msg);
+       lnet_msg_free(msg);
        return 0;
 }
 
 void
-lnet_finalize (lnet_ni_t *ni, lnet_msg_t *msg, int status)
+lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int status)
 {
        struct lnet_msg_container       *container;
        int                             my_slot;
@@ -443,27 +443,11 @@ lnet_finalize (lnet_ni_t *ni, lnet_msg_t *msg, int status)
        int                             rc;
        int                             i;
 
-       LASSERT (!in_interrupt ());
+       LASSERT(!in_interrupt());
 
        if (msg == NULL)
                return;
-#if 0
-        CDEBUG(D_WARNING, "%s msg->%s Flags:%s%s%s%s%s%s%s%s%s%s%s txp %s rxp %s\n",
-               lnet_msgtyp2str(msg->msg_type), libcfs_id2str(msg->msg_target),
-               msg->msg_target_is_router ? "t" : "",
-               msg->msg_routing ? "X" : "",
-               msg->msg_ack ? "A" : "",
-               msg->msg_sending ? "S" : "",
-               msg->msg_receiving ? "R" : "",
-               msg->msg_delayed ? "d" : "",
-               msg->msg_txcredit ? "C" : "",
-               msg->msg_peertxcredit ? "c" : "",
-               msg->msg_rtrcredit ? "F" : "",
-               msg->msg_peerrtrcredit ? "f" : "",
-               msg->msg_onactivelist ? "!" : "",
-               msg->msg_txpeer == NULL ? "<none>" : libcfs_nid2str(msg->msg_txpeer->lp_nid),
-               msg->msg_rxpeer == NULL ? "<none>" : libcfs_nid2str(msg->msg_rxpeer->lp_nid));
-#endif
+
         msg->msg_ev.status = status;
 
        if (msg->msg_md != NULL) {
@@ -489,17 +473,7 @@ lnet_finalize (lnet_ni_t *ni, lnet_msg_t *msg, int status)
         * (finalize sending first then finalize receiving)
         */
        cpt = msg->msg_tx_committed ? msg->msg_tx_cpt : msg->msg_rx_cpt;
-
        lnet_net_lock(cpt);
-       if (msg->msg_tx_committed && msg->msg_txpeer != NULL && status == 0) {
-               lnet_peer_t *lp = msg->msg_txpeer;
-
-               /* LND is finalising a outgoing message for txpeer, so asssume
-                * it is alive */
-               lp->lp_last_alive = lp->lp_last_query = cfs_time_current();
-               if (!lp->lp_alive)
-                       lnet_notify_locked(lp, 0, 1, lp->lp_last_alive);
-       }
 
        container = the_lnet.ln_msg_containers[cpt];
        list_add_tail(&msg->msg_list, &container->msc_finalizing);
@@ -507,7 +481,6 @@ lnet_finalize (lnet_ni_t *ni, lnet_msg_t *msg, int status)
        /* Recursion breaker.  Don't complete the message here if I am (or
         * enough other threads are) already completing messages */
 
-#ifdef __KERNEL__
        my_slot = -1;
        for (i = 0; i < container->msc_nfinalizers; i++) {
                if (container->msc_finalizers[i] == current)
@@ -523,16 +496,6 @@ lnet_finalize (lnet_ni_t *ni, lnet_msg_t *msg, int status)
        }
 
        container->msc_finalizers[my_slot] = current;
-#else
-       LASSERT(container->msc_nfinalizers == 1);
-       if (container->msc_finalizers[0] != NULL) {
-               lnet_net_unlock(cpt);
-               return;
-       }
-
-       my_slot = i = 0;
-       container->msc_finalizers[0] = (struct lnet_msg_container *)1;
-#endif
 
        while (!list_empty(&container->msc_finalizing)) {
                msg = list_entry(container->msc_finalizing.next,
@@ -589,9 +552,6 @@ lnet_msg_container_cleanup(struct lnet_msg_container *container)
                            sizeof(*container->msc_finalizers));
                container->msc_finalizers = NULL;
        }
-#ifdef LNET_USE_LIB_FREELIST
-       lnet_freelist_fini(&container->msc_freelist);
-#endif
        container->msc_init = 0;
 }
 
@@ -605,19 +565,7 @@ lnet_msg_container_setup(struct lnet_msg_container *container, int cpt)
        INIT_LIST_HEAD(&container->msc_active);
        INIT_LIST_HEAD(&container->msc_finalizing);
 
-#ifdef LNET_USE_LIB_FREELIST
-       memset(&container->msc_freelist, 0, sizeof(lnet_freelist_t));
-
-       rc = lnet_freelist_init(&container->msc_freelist,
-                               LNET_FL_MAX_MSGS, sizeof(lnet_msg_t));
-       if (rc != 0) {
-               CERROR("Failed to init freelist for message container\n");
-               lnet_msg_container_cleanup(container);
-               return rc;
-       }
-#else
        rc = 0;
-#endif
        /* number of CPUs */
        container->msc_nfinalizers = cfs_cpt_weight(lnet_cpt_table(), cpt);