Whamcloud - gitweb
LU-8130 ldlm: store name directly in namespace. 08/32408/2
authorNeilBrown <neilb@suse.com>
Tue, 15 May 2018 17:29:27 +0000 (13:29 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 29 May 2018 04:55:14 +0000 (04:55 +0000)
Rather than storing the name of a namespace in the
hash table, store it directly in the namespace.
This will allow the hashtable to be changed to use
rhashtable.

Linux-commit: 648ae363628c84faa8d8861e3246e096b8c0a392

Change-Id: Ie5bb8092c9e1831fbc38beade46be6d35f3256dc
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-on: https://review.whamcloud.com/32408
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
lustre/include/lustre_dlm.h
lustre/ldlm/ldlm_resource.c

index ac3ec39..5015648 100644 (file)
@@ -378,6 +378,9 @@ struct ldlm_namespace {
        /** Flag indicating if namespace is on client instead of server */
        enum ldlm_side          ns_client;
 
+       /** name of this namespace */
+       char                    *ns_name;
+
        /** Resource hash table for namespace. */
        struct cfs_hash         *ns_rs_hash;
 
@@ -1046,7 +1049,7 @@ static inline bool ldlm_has_dom(struct ldlm_lock *lock)
 static inline char *
 ldlm_ns_name(struct ldlm_namespace *ns)
 {
-        return ns->ns_rs_hash->hs_name;
+       return ns->ns_name;
 }
 
 static inline struct ldlm_namespace *
index cbbb074..49e5a0d 100644 (file)
@@ -968,9 +968,12 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
                nsb->nsb_reclaim_start = 0;
         }
 
-        ns->ns_obd      = obd;
-        ns->ns_appetite = apt;
-        ns->ns_client   = client;
+       ns->ns_obd = obd;
+       ns->ns_appetite = apt;
+       ns->ns_client = client;
+       ns->ns_name = kstrdup(name, GFP_KERNEL);
+       if (!ns->ns_name)
+               goto out_hash;
 
        INIT_LIST_HEAD(&ns->ns_list_chain);
        INIT_LIST_HEAD(&ns->ns_unused_list);
@@ -1022,7 +1025,8 @@ out_sysfs:
        ldlm_namespace_sysfs_unregister(ns);
        ldlm_namespace_cleanup(ns, 0);
 out_hash:
-        cfs_hash_putref(ns->ns_rs_hash);
+       kfree(ns->ns_name);
+       cfs_hash_putref(ns->ns_rs_hash);
 out_ns:
         OBD_FREE_PTR(ns);
 out_ref:
@@ -1286,9 +1290,11 @@ void ldlm_namespace_free_post(struct ldlm_namespace *ns)
        ldlm_namespace_debugfs_unregister(ns);
        ldlm_namespace_sysfs_unregister(ns);
        cfs_hash_putref(ns->ns_rs_hash);
+       kfree(ns->ns_name);
        /* Namespace \a ns should be not on list at this time, otherwise
         * this will cause issues related to using freed \a ns in poold
-        * thread. */
+        * thread.
+        */
        LASSERT(list_empty(&ns->ns_list_chain));
        OBD_FREE_PTR(ns);
        ldlm_put_ref();