Whamcloud - gitweb
LU-56 lnet: cleanup for LNet Event Queue
[fs/lustre-release.git] / lnet / lnet / lib-md.c
index c01f2b0..821178d 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -62,7 +60,7 @@ lnet_md_unlink(lnet_libmd_t *md)
                 }
 
                 /* ensure all future handle lookups fail */
-                lnet_invalidate_handle(&md->md_lh);
+               lnet_res_lh_invalidate(&md->md_lh);
         }
 
         if (md->md_refcount != 0) {
@@ -79,7 +77,7 @@ lnet_md_unlink(lnet_libmd_t *md)
 
         LASSERT (!cfs_list_empty(&md->md_list));
         cfs_list_del_init (&md->md_list);
-        lnet_md_free(md);
+       lnet_md_free_locked(md);
 }
 
 /* must be called with LNET_LOCK held */
@@ -186,11 +184,11 @@ lib_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink)
                 eq->eq_refcount++;
 
         /* It's good; let handle2md succeed and add to active mds */
-        lnet_initialise_handle (&lmd->md_lh, LNET_COOKIE_TYPE_MD);
-        LASSERT (cfs_list_empty(&lmd->md_list));
-        cfs_list_add (&lmd->md_list, &the_lnet.ln_active_mds);
+       lnet_res_lh_initialize(&the_lnet.ln_md_container, &lmd->md_lh);
+       LASSERT(cfs_list_empty(&lmd->md_list));
+       cfs_list_add(&lmd->md_list, &the_lnet.ln_md_container.rec_active);
 
-        return 0;
+       return 0;
 }
 
 /* must be called with LNET_LOCK held */
@@ -215,8 +213,9 @@ lnet_md_deconstruct(lnet_libmd_t *lmd, lnet_md_t *umd)
 int
 lnet_md_validate(lnet_md_t *umd)
 {
-        if (umd->start == NULL) {
-                CERROR("MD start pointer can not be NULL\n");
+        if (umd->start == NULL && umd->length != 0) {
+                CERROR("MD start pointer can not be NULL with length %u\n",
+                       umd->length);
                 return -EINVAL;
         }
 
@@ -303,7 +302,7 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd,
                 }
         }
 
-        lnet_md_free (md);
+       lnet_md_free_locked(md);
 
         LNET_UNLOCK();
         return (rc);
@@ -357,7 +356,7 @@ LNetMDBind(lnet_md_t umd, lnet_unlink_t unlink, lnet_handle_md_t *handle)
                 return (0);
         }
 
-        lnet_md_free (md);
+       lnet_md_free_locked(md);
 
         LNET_UNLOCK();
         return (rc);
@@ -416,7 +415,7 @@ LNetMDUnlink (lnet_handle_md_t mdh)
         if (md->md_eq != NULL &&
             md->md_refcount == 0) {
                 lnet_build_unlink_event(md, &ev);
-                lnet_enq_event_locked(md->md_eq, &ev);
+               lnet_eq_enqueue_event(md->md_eq, &ev);
         }
 
         lnet_md_unlink(md);