Whamcloud - gitweb
Commented proc code
[fs/lustre-release.git] / lustre / ldlm / ldlm_resource.c
index 8412473..ac53d84 100644 (file)
@@ -12,6 +12,7 @@
 #define DEBUG_SUBSYSTEM S_LDLM
 
 #include <linux/lustre_dlm.h>
+#include <linux/obd_class.h>
 
 kmem_cache_t *ldlm_resource_slab, *ldlm_lock_slab;
 
@@ -55,6 +56,7 @@ struct ldlm_namespace *ldlm_namespace_new(char *name, __u32 client)
                 LBUG();
                 GOTO(out, ns);
         }
+        obd_memory += sizeof(*ns->ns_hash) * RES_HASH_SIZE;
 
         OBD_ALLOC(ns->ns_name, strlen(name) + 1);
         if (!ns->ns_name) {
@@ -63,9 +65,6 @@ struct ldlm_namespace *ldlm_namespace_new(char *name, __u32 client)
         }
         strcpy(ns->ns_name, name);
 
-        ptlrpc_init_client(NULL, NULL, LDLM_REQUEST_PORTAL, LDLM_REPLY_PORTAL,
-                           &ns->ns_rpc_client);
-
         INIT_LIST_HEAD(&ns->ns_root_list);
         l_lock_init(&ns->ns_lock);
         ns->ns_refcount = 0;
@@ -85,8 +84,10 @@ struct ldlm_namespace *ldlm_namespace_new(char *name, __u32 client)
         RETURN(ns);
 
  out:
-        if (ns && ns->ns_hash)
+        if (ns && ns->ns_hash) {
                 vfree(ns->ns_hash);
+                obd_memory -= sizeof(*ns->ns_hash) * RES_HASH_SIZE;
+        }
         if (ns && ns->ns_name)
                 OBD_FREE(ns->ns_name, strlen(name) + 1);
         if (ns)
@@ -165,14 +166,21 @@ int ldlm_namespace_free(struct ldlm_namespace *ns)
                 }
         }
 
-        vfree(ns->ns_hash /* , sizeof(struct list_head) * RES_HASH_SIZE */);
-        ptlrpc_cleanup_client(&ns->ns_rpc_client);
+        vfree(ns->ns_hash /* , sizeof(*ns->ns_hash) * RES_HASH_SIZE */);
+        obd_memory -= sizeof(*ns->ns_hash) * RES_HASH_SIZE;
         OBD_FREE(ns->ns_name, strlen(ns->ns_name) + 1);
         OBD_FREE(ns, sizeof(*ns));
 
         return ELDLM_OK;
 }
 
+int ldlm_client_free(struct obd_export *exp)
+{
+        struct ldlm_export_data *led = &exp->exp_ldlm_data;
+        ptlrpc_cleanup_client(&led->led_import);
+        RETURN(0);
+}
+
 static __u32 ldlm_hash_fn(struct ldlm_resource *parent, __u64 *name)
 {
         __u32 hash = 0;