Whamcloud - gitweb
LU-1425 build: make Lustre build ready for gcov
[fs/lustre-release.git] / lnet / lnet / lib-me.c
index 4324961..8df9917 100644 (file)
@@ -92,9 +92,9 @@ LNetMEAttach(unsigned int portal,
        if (mtable == NULL) /* can't match portal type */
                return -EPERM;
 
-        me = lnet_me_alloc();
-        if (me == NULL)
-                return -ENOMEM;
+       me = lnet_me_alloc();
+       if (me == NULL)
+               return -ENOMEM;
 
        lnet_res_lock(mtable->mt_cpt);
 
@@ -107,8 +107,12 @@ LNetMEAttach(unsigned int portal,
 
        lnet_res_lh_initialize(the_lnet.ln_me_containers[mtable->mt_cpt],
                               &me->me_lh);
-       head = lnet_mt_match_head(mtable, match_id, match_bits);
+       if (ignore_bits != 0)
+               head = &mtable->mt_mhash[LNET_MT_HASH_IGNORE];
+       else
+               head = lnet_mt_match_head(mtable, match_id, match_bits);
 
+       me->me_pos = head - &mtable->mt_mhash[0];
        if (pos == LNET_INS_AFTER || pos == LNET_INS_LOCAL)
                cfs_list_add_tail(&me->me_list, head);
        else
@@ -119,6 +123,7 @@ LNetMEAttach(unsigned int portal,
        lnet_res_unlock(mtable->mt_cpt);
        return 0;
 }
+EXPORT_SYMBOL(LNetMEAttach);
 
 /**
  * Create and a match entry and insert it before or after the ME pointed to by
@@ -155,9 +160,9 @@ LNetMEInsert(lnet_handle_me_t current_meh,
        if (pos == LNET_INS_LOCAL)
                return -EPERM;
 
-        new_me = lnet_me_alloc();
-        if (new_me == NULL)
-                return -ENOMEM;
+       new_me = lnet_me_alloc();
+       if (new_me == NULL)
+               return -ENOMEM;
 
        cpt = lnet_cpt_of_cookie(current_meh.cookie);
 
@@ -175,12 +180,13 @@ LNetMEInsert(lnet_handle_me_t current_meh,
 
        ptl = the_lnet.ln_portals[current_me->me_portal];
        if (lnet_ptl_is_unique(ptl)) {
-                /* nosense to insertion on unique portal */
+               /* nosense to insertion on unique portal */
                lnet_me_free_locked(new_me);
                lnet_res_unlock(cpt);
                return -EPERM;
         }
 
+       new_me->me_pos = current_me->me_pos;
         new_me->me_portal = current_me->me_portal;
         new_me->me_match_id = match_id;
         new_me->me_match_bits = match_bits;
@@ -201,6 +207,7 @@ LNetMEInsert(lnet_handle_me_t current_meh,
 
        return 0;
 }
+EXPORT_SYMBOL(LNetMEInsert);
 
 /**
  * Unlink a match entry from its match list.
@@ -249,6 +256,7 @@ LNetMEUnlink(lnet_handle_me_t meh)
        lnet_res_unlock(cpt);
        return 0;
 }
+EXPORT_SYMBOL(LNetMEUnlink);
 
 /* call with lnet_res_lock please */
 void