Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 648ae363 authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman
Browse files

staging: lustre: ldlm: store name directly in namespace.



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.

Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Reviewed-by: default avatarJames Simmons <jsimmons@infradead.org>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@dilger.ca>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7f907bf6
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -362,6 +362,9 @@ struct ldlm_namespace {
	/** Flag indicating if namespace is on client instead of server */
	/** Flag indicating if namespace is on client instead of server */
	enum ldlm_side		ns_client;
	enum ldlm_side		ns_client;


	/** name of this namespace */
	char			*ns_name;

	/** Resource hash table for namespace. */
	/** Resource hash table for namespace. */
	struct cfs_hash		*ns_rs_hash;
	struct cfs_hash		*ns_rs_hash;


@@ -878,7 +881,7 @@ static inline bool ldlm_has_layout(struct ldlm_lock *lock)
static inline char *
static inline char *
ldlm_ns_name(struct ldlm_namespace *ns)
ldlm_ns_name(struct ldlm_namespace *ns)
{
{
	return ns->ns_rs_hash->hs_name;
	return ns->ns_name;
}
}


static inline struct ldlm_namespace *
static inline struct ldlm_namespace *
+5 −0
Original line number Original line Diff line number Diff line
@@ -688,6 +688,9 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
	ns->ns_obd      = obd;
	ns->ns_obd      = obd;
	ns->ns_appetite = apt;
	ns->ns_appetite = apt;
	ns->ns_client   = client;
	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_list_chain);
	INIT_LIST_HEAD(&ns->ns_unused_list);
	INIT_LIST_HEAD(&ns->ns_unused_list);
@@ -730,6 +733,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
	ldlm_namespace_sysfs_unregister(ns);
	ldlm_namespace_sysfs_unregister(ns);
	ldlm_namespace_cleanup(ns, 0);
	ldlm_namespace_cleanup(ns, 0);
out_hash:
out_hash:
	kfree(ns->ns_name);
	cfs_hash_putref(ns->ns_rs_hash);
	cfs_hash_putref(ns->ns_rs_hash);
out_ns:
out_ns:
	kfree(ns);
	kfree(ns);
@@ -993,6 +997,7 @@ void ldlm_namespace_free_post(struct ldlm_namespace *ns)
	ldlm_namespace_debugfs_unregister(ns);
	ldlm_namespace_debugfs_unregister(ns);
	ldlm_namespace_sysfs_unregister(ns);
	ldlm_namespace_sysfs_unregister(ns);
	cfs_hash_putref(ns->ns_rs_hash);
	cfs_hash_putref(ns->ns_rs_hash);
	kfree(ns->ns_name);
	/* Namespace \a ns should be not on list at this time, otherwise
	/* Namespace \a ns should be not on list at this time, otherwise
	 * this will cause issues related to using freed \a ns in poold
	 * this will cause issues related to using freed \a ns in poold
	 * thread.
	 * thread.