Whamcloud - gitweb
Land b1_6_bug11013 onto HEAD (20070313_0924)
[fs/lustre-release.git] / lustre / obdclass / obd_config.c
index 51badf4..31b9f62 100644 (file)
 #include <lprocfs_status.h>
 #include <libcfs/list.h>
 #include <lustre_param.h>
+#include <class_hash.h>
+
+extern struct lustre_hash_operations uuid_hash_operations;
+extern struct lustre_hash_operations nid_hash_operations;
 
 /*********** string parsing utils *********/
 
@@ -271,6 +275,19 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         /* just leave this on forever.  I can't use obd_set_up here because
            other fns check that status, and we're not actually set up yet. */
         obd->obd_starting = 1;
+        /* create an uuid-export hash body */
+        err = lustre_hash_init(&obd->obd_uuid_hash_body, "UUID_HASH", 
+                               128, &uuid_hash_operations);
+        if (err)
+                GOTO(err_exp, err);
+
+        /* create a nid-export hash body */
+        err = lustre_hash_init(&obd->obd_nid_hash_body, "NID_HASH", 
+                               128, &nid_hash_operations);
+        if (err)
+                GOTO(err_exp, err);
+
         spin_unlock(&obd->obd_dev_lock);
 
         exp = class_new_export(obd, &obd->obd_uuid);
@@ -297,6 +314,8 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 
 err_exp:
         CERROR("setup %s failed (%d)\n", obd->obd_name, err);
+        lustre_hash_exit(&obd->obd_uuid_hash_body);
+        lustre_hash_exit(&obd->obd_nid_hash_body);
         class_unlink_export(obd->obd_self_export);
         obd->obd_self_export = NULL;
         obd->obd_starting = 0;
@@ -430,6 +449,12 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg)
 
         LASSERT(obd->obd_self_export);
 
+        /* destroy an uuid-export hash body */
+        lustre_hash_exit(&obd->obd_uuid_hash_body);
+
+        /* destroy a nid-export hash body */
+        lustre_hash_exit(&obd->obd_nid_hash_body);
+
         /* Precleanup stage 1, we must make sure all exports (other than the
            self-export) get destroyed. */
         err = obd_precleanup(obd, OBD_CLEANUP_EXPORTS);