Received: by 10.192.165.148 with SMTP id m20csp4497430imm; Mon, 30 Apr 2018 20:53:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqKKrIml/2/720KtH0xzwvsMPmF0aBN5PG8WrUtm4P2k7IFwYj+bGg53ay0QzLFEAflAbW9 X-Received: by 10.98.2.72 with SMTP id 69mr14281720pfc.12.1525146823217; Mon, 30 Apr 2018 20:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525146823; cv=none; d=google.com; s=arc-20160816; b=wZrNWs85ozkjhdviiIWEo1rB2BFYqGgSJ3z8kxcMMEPQuiiwI6o+07qgfYH4DkDymI XLiA+lNEjnKG/yjDnnWvkbaWekG2RQS9vDAv2CFpSVEB5n6xogLVGdYYBPKCjRhU9oeL E+Xp2zAixBhk4CeoclmI+GoF2SThH1rP7+iQmZ20OVl5o4Qy++tI0ZlpWQqAUrDR49YE QAGX30eE5JJICzeoEZ+UbSGKwr0Fvo7Y4Vl8etIuurfGnWIXTcN88tR2mOrNaOlICwkW b9Q+4Ec8RO426+QTBi9p4NDdc/pnrPFU0rtthKTjrKL5PQXdIIj+IHcRz/DgCUTnFsoQ hM/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:cc:subject:date:to :from:arc-authentication-results; bh=beEO4xl03KFMSLO5fr+YCYumaifnzFwPy68fnXHNlSM=; b=gPZUSsdVw6WzH4v1uhqjcUPFOoMBw9Pfv+La30yB5k6bjYQx1C6RxqTjSDd272lGYc Bp7MYtIAR988wstafMTNPbvtMXemzBe4WddA/ntEZpSLpyk/AfL2r3GcU2RQGFR9BHaD YIrsCaYceds21XRVVyWeqmGtJpdiOYdto0l+3VIz6pGgLx3bS6/5grvPWCvMvhSQWAoU jp2IzQbqjMdm07d2h2pRPgf4BJpgr+Bv3/gsDcoqKS3arwvBgNGQkfpVmuIzjAxlteLo /W1X7PCUER1lRLvYUhU1P/4jIQZ1ss/i3ORfJ3uDA7tWBblEMPjGe7Pu1s/MWnLwzwgY VBaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9-v6si8742086plk.516.2018.04.30.20.53.29; Mon, 30 Apr 2018 20:53:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754055AbeEADxJ (ORCPT + 99 others); Mon, 30 Apr 2018 23:53:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:59103 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbeEADxG (ORCPT ); Mon, 30 Apr 2018 23:53:06 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D4B4AAE54; Tue, 1 May 2018 03:53:04 +0000 (UTC) From: NeilBrown To: Oleg Drokin , Greg Kroah-Hartman , James Simmons , Andreas Dilger Date: Tue, 01 May 2018 13:52:38 +1000 Subject: [PATCH 01/10] staging: lustre: ldlm: store name directly in namespace. Cc: Linux Kernel Mailing List , Lustre Development List Message-ID: <152514675876.17843.12443354625160742215.stgit@noble> In-Reply-To: <152514658325.17843.11455067361317157487.stgit@noble> References: <152514658325.17843.11455067361317157487.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: NeilBrown --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 5 ++++- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index d668d86423a4..b3532adac31c 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -362,6 +362,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; @@ -878,7 +881,7 @@ static inline bool ldlm_has_layout(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 * diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 6c615b6e9bdc..43bbc5fd94cc 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -688,6 +688,9 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, 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); @@ -730,6 +733,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, ldlm_namespace_sysfs_unregister(ns); ldlm_namespace_cleanup(ns, 0); out_hash: + kfree(ns->ns_name); cfs_hash_putref(ns->ns_rs_hash); out_ns: kfree(ns); @@ -993,6 +997,7 @@ 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.