Received: by 10.192.165.148 with SMTP id m20csp4504849imm; Mon, 30 Apr 2018 21:04:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr4IUd4A39FXNF0THYqvD03KecxXYCWWsxp08oMQYl5zUmOzJdg+7+NpdBZAG/3iJkSMdrL X-Received: by 2002:a63:60c1:: with SMTP id u184-v6mr11687756pgb.122.1525147492950; Mon, 30 Apr 2018 21:04:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525147492; cv=none; d=google.com; s=arc-20160816; b=LvOg5OfylYVPNc7D0Pd90tnDlQAPo6c75b5EW0XWwdySsc0zSXBxkobKn1+1eCX5fq GO5T2oQ/9IpvAgOKyq7V1mqWZpibUPwBNjALyRZbuQNqD7nCINagvIV3KZk43W5VnMra KdXooy7MfO1QSkdVb3y1VL6DfessV1PJrn9C8aYifBiFRUYrSSyv+nD3E0jPV8nceI8O +9DpWQKRy+P2B3zjiFpxSoIEmMMwAzkU2MTjAcEuJ3jYz0jc0bympQ3oLIZ0+aMJCADP Nf2Gv9ummGOectELKypwKQ6wpKLziVEBDdYWS3xU2EwsXwsDbe85HD8D37NvQes6sFRH a82w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=2xGjg7OfMH4Tlh3OumC1lFrr2SK1g0bqAXJZScm5Cfw=; b=RlnSU3QJZG1H94S8zmNfL7IVzt+o+YXBsN9K0kdXemwcFMovd+1GOdxi/gor8iuuBu fyWxi2snkYrAODtdn3BGduhIUP36lu1RPGTL+78OAaIowUYbfLFpHAUiHQiuJNLJiVMM fMMZkD6gh2Z2Q6KO2o9DPisuNftN8hUMACKJ9ri19K8rQkMfIgDoH+IAQ6V+adANwvgQ RYRWsK/myodtiN+xSFfgpdhqncvDzlb3eYgWU7hWbHn7RRz3JNtEnjWmLmUtRPYknAOt PP/ZfCV7dmOlxsz1nfh63I5YLGJCvkZqgjRTX+jcpbwy3ypTO4RkIvkCFNhkHn35Q/pF 1JSg== 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 h11-v6si7123424pgs.44.2018.04.30.21.04.35; Mon, 30 Apr 2018 21:04:52 -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 S1750857AbeEAEE1 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 1 May 2018 00:04:27 -0400 Received: from mga01.intel.com ([192.55.52.88]:12262 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750713AbeEAEE0 (ORCPT ); Tue, 1 May 2018 00:04:26 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2018 21:04:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,349,1520924400"; d="scan'208";a="37444423" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga007.jf.intel.com with ESMTP; 30 Apr 2018 21:04:25 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 30 Apr 2018 21:04:25 -0700 Received: from FMSMSX109.amr.corp.intel.com ([169.254.15.12]) by fmsmsx115.amr.corp.intel.com ([169.254.4.201]) with mapi id 14.03.0319.002; Mon, 30 Apr 2018 21:04:25 -0700 From: "Dilger, Andreas" To: NeilBrown CC: "Drokin, Oleg" , Greg Kroah-Hartman , James Simmons , "Linux Kernel Mailing List" , Lustre Development List Subject: Re: [PATCH 01/10] staging: lustre: ldlm: store name directly in namespace. Thread-Topic: [PATCH 01/10] staging: lustre: ldlm: store name directly in namespace. Thread-Index: AQHT4P/q6yCnmFZRCE+A4LP23VuYHaQatlKA Date: Tue, 1 May 2018 04:04:24 +0000 Message-ID: <74BA6824-9336-47B6-BCD6-A2E91E15A115@intel.com> References: <152514658325.17843.11455067361317157487.stgit@noble> <152514675876.17843.12443354625160742215.stgit@noble> In-Reply-To: <152514675876.17843.12443354625160742215.stgit@noble> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.252.137.157] Content-Type: text/plain; charset="us-ascii" Content-ID: <13AFF2C206627242836D3A021143B5DD@intel.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Apr 30, 2018, at 21:52, NeilBrown wrote: > > 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 Reviewed-by: Andreas Dilger > --- > 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. > > Cheers, Andreas -- Andreas Dilger Lustre Principal Architect Intel Corporation