linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/19] Lustre cleanups
@ 2015-09-16  0:30 green
  2015-09-16  0:30 ` [PATCH 01/19] staging/lustre: Remove OBD_CPT_ALLOC_LARGE green
                   ` (18 more replies)
  0 siblings, 19 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

This bunch of patches removes significant chunks of
Lustre specific allocators which is possible thanks to prior patches
from Julia Lawall.
Also removed are some server-only bits of code that make no sense
to retain in a client.

Please consider.

Oleg Drokin (19):
  staging/lustre: Remove OBD_CPT_ALLOC_LARGE
  staging/lustre: Remove unused OBD_VMALLOC
  staging/lustre: Remove unused OBD_CPT_ALLOC* macros
  staging/lustre: Remove users of OBD_ALLOC/FREE_PTR lu_object.h
  staging/lustre/llite: Get rid of OBD_ALLOC/FREE_PTR
  staging/lustre/obdclass: replace OBD_ALLOC_GFP with kzalloc
  staging/lustre: Remove references to OBD_ALLOC/FREE* in comments
  staging/lustre/fld: Replace OBD_ALLOC_GFP with kzalloc
  staging/lustre: Convert lustre_cfg_new/free to use kzalloc/kfree
  staging/lustre/ptlrpc: Replace OBD_FREE_PTR with kfree
  staging/lustre: Replace last users of OBD_ALLOC/FREE_LARGE
  staging/lustre: Remove stray bit of userland utils code
  staging/lustre: Remove unused OBD_ALLOC* and OBD_FREE macros
  staging/lustre: Remove memory allocation fault injection framework
  staging/lustre: Remove lustre used memory tracking framework
  staging/lustre: remove obd_memory stats counter
  staging/lustre: Remove IS_SERVER and all users
  staging/lustre: remove IS_MDS|IS_OST|IS_MGS defines and users
  staging/lustre: Remove server defines from lustre_disk.h

 drivers/staging/lustre/lustre/fld/fld_cache.c      |   2 +-
 drivers/staging/lustre/lustre/include/lu_object.h  |   4 +-
 drivers/staging/lustre/lustre/include/lustre_cfg.h |   6 +-
 .../staging/lustre/lustre/include/lustre_disk.h    | 142 ---------------
 drivers/staging/lustre/lustre/include/lustre_lib.h |   4 +-
 drivers/staging/lustre/lustre/include/lustre_net.h |   2 +-
 drivers/staging/lustre/lustre/include/obd.h        |  12 +-
 .../staging/lustre/lustre/include/obd_support.h    | 198 +--------------------
 drivers/staging/lustre/lustre/llite/file.c         |   2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c    |   2 +-
 drivers/staging/lustre/lustre/mgc/mgc_request.c    |  44 +----
 drivers/staging/lustre/lustre/obdclass/cl_page.c   |   3 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c | 103 -----------
 .../staging/lustre/lustre/obdclass/llog_internal.h |   8 -
 .../lustre/lustre/obdclass/lprocfs_counters.c      |   9 -
 .../lustre/lustre/obdclass/lprocfs_status.c        |   2 +-
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |  91 ++--------
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c    |   2 +-
 drivers/staging/lustre/lustre/ptlrpc/pinger.c      |   2 -
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |   2 +-
 drivers/staging/lustre/lustre/ptlrpc/service.c     |   6 +-
 21 files changed, 46 insertions(+), 600 deletions(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 01/19] staging/lustre: Remove OBD_CPT_ALLOC_LARGE
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 02/19] staging/lustre: Remove unused OBD_VMALLOC green
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Remove OBD_CPT_ALLOC_LARGE define and convert the only user to
libcfs_kvzalloc_cpt.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/obd_support.h | 5 -----
 drivers/staging/lustre/lustre/ptlrpc/service.c      | 6 ++++--
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 30f22d9..b746763 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -634,11 +634,6 @@ do {									  \
 	ptr = libcfs_kvzalloc(size, GFP_NOFS);				  \
 } while (0)
 
-#define OBD_CPT_ALLOC_LARGE(ptr, cptab, cpt, size)			      \
-do {									      \
-	ptr = libcfs_kvzalloc_cpt(cptab, cpt, size, GFP_NOFS);		      \
-} while (0)
-
 #define OBD_FREE_LARGE(ptr, size)					     \
 do {									  \
 	(void)(size);							\
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c
index 003344c..40de622 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
@@ -86,8 +86,10 @@ ptlrpc_alloc_rqbd(struct ptlrpc_service_part *svcpt)
 	rqbd->rqbd_cbid.cbid_fn = request_in_callback;
 	rqbd->rqbd_cbid.cbid_arg = rqbd;
 	INIT_LIST_HEAD(&rqbd->rqbd_reqs);
-	OBD_CPT_ALLOC_LARGE(rqbd->rqbd_buffer, svc->srv_cptable,
-			    svcpt->scp_cpt, svc->srv_buf_size);
+	rqbd->rqbd_buffer = libcfs_kvzalloc_cpt(svc->srv_cptable,
+						svcpt->scp_cpt,
+						svc->srv_buf_size,
+						GFP_KERNEL);
 	if (rqbd->rqbd_buffer == NULL) {
 		kfree(rqbd);
 		return NULL;
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 02/19] staging/lustre: Remove unused OBD_VMALLOC
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
  2015-09-16  0:30 ` [PATCH 01/19] staging/lustre: Remove OBD_CPT_ALLOC_LARGE green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 03/19] staging/lustre: Remove unused OBD_CPT_ALLOC* macros green
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

These macros are not used anymore, so let's remove them,
also __OBD_VMALLOC_VEROBSE and OBD_CPT_VMALLOC

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../staging/lustre/lustre/include/obd_support.h    | 29 ----------------------
 1 file changed, 29 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index b746763..f58d142 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -608,27 +608,6 @@ do {									      \
 #define OBD_CPT_ALLOC_PTR(ptr, cptab, cpt)				      \
 	OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
 
-# define __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size)			      \
-do {									      \
-	(ptr) = cptab == NULL ?						      \
-		vzalloc(size) :						      \
-		vzalloc_node(size, cfs_cpt_spread_node(cptab, cpt));	      \
-	if (unlikely((ptr) == NULL)) {					\
-		CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n",	   \
-		       (int)(size));					  \
-		CERROR("%llu total bytes allocated by Lustre\n",	      \
-		       obd_memory_sum());				      \
-	} else {							      \
-		OBD_ALLOC_POST(ptr, size, "vmalloced");		       \
-	}								     \
-} while (0)
-
-# define OBD_VMALLOC(ptr, size)						      \
-	 __OBD_VMALLOC_VEROBSE(ptr, NULL, 0, size)
-# define OBD_CPT_VMALLOC(ptr, cptab, cpt, size)				      \
-	 __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size)
-
-
 #define OBD_ALLOC_LARGE(ptr, size)					    \
 do {									  \
 	ptr = libcfs_kvzalloc(size, GFP_NOFS);				  \
@@ -677,14 +656,6 @@ do {									      \
 	POISON_PTR(ptr);						      \
 } while (0)
 
-
-#define OBD_VFREE(ptr, size)				\
-	do {						\
-		OBD_FREE_PRE(ptr, size, "vfreed");	\
-		vfree(ptr);			\
-		POISON_PTR(ptr);			\
-	} while (0)
-
 /* we memset() the slab object to 0 when allocation succeeds, so DO NOT
  * HAVE A CTOR THAT DOES ANYTHING.  its work will be cleared here.  we'd
  * love to assert on that, but slab.c keeps kmem_cache_s all to itself. */
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 03/19] staging/lustre: Remove unused OBD_CPT_ALLOC* macros
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
  2015-09-16  0:30 ` [PATCH 01/19] staging/lustre: Remove OBD_CPT_ALLOC_LARGE green
  2015-09-16  0:30 ` [PATCH 02/19] staging/lustre: Remove unused OBD_VMALLOC green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 04/19] staging/lustre: Remove users of OBD_ALLOC/FREE_PTR lu_object.h green
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

OBD_CPT_ALLOC and friends are no longer used, so remove them.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/obd_support.h | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index f58d142..5ae35fa 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -599,15 +599,6 @@ do {									      \
 #define OBD_ALLOC_PTR(ptr) OBD_ALLOC(ptr, sizeof(*(ptr)))
 #define OBD_ALLOC_PTR_WAIT(ptr) OBD_ALLOC_WAIT(ptr, sizeof(*(ptr)))
 
-#define OBD_CPT_ALLOC_GFP(ptr, cptab, cpt, size, gfp_mask)		      \
-	__OBD_MALLOC_VERBOSE(ptr, cptab, cpt, size, gfp_mask)
-
-#define OBD_CPT_ALLOC(ptr, cptab, cpt, size)				      \
-	OBD_CPT_ALLOC_GFP(ptr, cptab, cpt, size, GFP_NOFS)
-
-#define OBD_CPT_ALLOC_PTR(ptr, cptab, cpt)				      \
-	OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
-
 #define OBD_ALLOC_LARGE(ptr, size)					    \
 do {									  \
 	ptr = libcfs_kvzalloc(size, GFP_NOFS);				  \
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 04/19] staging/lustre: Remove users of OBD_ALLOC/FREE_PTR lu_object.h
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (2 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 03/19] staging/lustre: Remove unused OBD_CPT_ALLOC* macros green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 05/19] staging/lustre/llite: Get rid of OBD_ALLOC/FREE_PTR green
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

These are converted to regular kzalloc/kfree calls.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/lu_object.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h
index 96e271d..7756008 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -1126,7 +1126,7 @@ struct lu_context_key {
 								  \
 		CLASSERT(PAGE_CACHE_SIZE >= sizeof (*value));       \
 								  \
-		OBD_ALLOC_PTR(value);			     \
+		value = kzalloc(sizeof(*value), GFP_NOFS);	\
 		if (value == NULL)				\
 			value = ERR_PTR(-ENOMEM);		 \
 								  \
@@ -1140,7 +1140,7 @@ struct lu_context_key {
 	{								   \
 		type *info = data;					  \
 									    \
-		OBD_FREE_PTR(info);					 \
+		kfree(info);					 \
 	}								   \
 	struct __##mod##__dummy_fini {; } /* semicolon catcher */
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 05/19] staging/lustre/llite: Get rid of OBD_ALLOC/FREE_PTR
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (3 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 04/19] staging/lustre: Remove users of OBD_ALLOC/FREE_PTR lu_object.h green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 06/19] staging/lustre/obdclass: replace OBD_ALLOC_GFP with kzalloc green
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

The remaining users in ll_open_cleanup and obd_mod_alloc
are converted to regular kzalloc/kfree.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/obd.h     | 4 ++--
 drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index 130f840..1013c33 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -1408,7 +1408,7 @@ static inline struct md_open_data *obd_mod_alloc(void)
 {
 	struct md_open_data *mod;
 
-	OBD_ALLOC_PTR(mod);
+	mod = kzalloc(sizeof(*mod), GFP_NOFS);
 	if (mod == NULL)
 		return NULL;
 	atomic_set(&mod->mod_refcount, 1);
@@ -1421,7 +1421,7 @@ static inline struct md_open_data *obd_mod_alloc(void)
 	if (atomic_dec_and_test(&(mod)->mod_refcount)) {	  \
 		if ((mod)->mod_open_req)			  \
 			ptlrpc_req_finished((mod)->mod_open_req);   \
-		OBD_FREE_PTR(mod);			      \
+		kfree(mod);			      \
 	}						       \
 })
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 725481d..aa68608 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1996,7 +1996,7 @@ void ll_open_cleanup(struct super_block *sb, struct ptlrpc_request *open_req)
 	struct obd_export		*exp	   = ll_s2sbi(sb)->ll_md_exp;
 
 	body = req_capsule_server_get(&open_req->rq_pill, &RMF_MDT_BODY);
-	OBD_ALLOC_PTR(op_data);
+	op_data = kzalloc(sizeof(*op_data), GFP_NOFS);
 	if (!op_data) {
 		CWARN("%s: cannot allocate op_data to release open handle for "
 		      DFID "\n",
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 06/19] staging/lustre/obdclass: replace OBD_ALLOC_GFP with kzalloc
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (4 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 05/19] staging/lustre/llite: Get rid of OBD_ALLOC/FREE_PTR green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 07/19] staging/lustre: Remove references to OBD_ALLOC/FREE* in comments green
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Part of getting rid of custom Lustre allocation macros.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/obdclass/cl_page.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c
index d5fb81f..e27062d 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_page.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c
@@ -283,8 +283,7 @@ static struct cl_page *cl_page_alloc(const struct lu_env *env,
 	struct cl_page	  *page;
 	struct lu_object_header *head;
 
-	OBD_ALLOC_GFP(page, cl_object_header(o)->coh_page_bufsize,
-			GFP_NOFS);
+	page = kzalloc(cl_object_header(o)->coh_page_bufsize, GFP_NOFS);
 	if (page != NULL) {
 		int result = 0;
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 07/19] staging/lustre: Remove references to OBD_ALLOC/FREE* in comments
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (5 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 06/19] staging/lustre/obdclass: replace OBD_ALLOC_GFP with kzalloc green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 08/19] staging/lustre/fld: Replace OBD_ALLOC_GFP with kzalloc green
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Since everything is now supposed to use regular kernel alloc and
free functions.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/lustre_lib.h  | 2 +-
 drivers/staging/lustre/lustre/include/lustre_net.h  | 2 +-
 drivers/staging/lustre/lustre/llite/file.c          | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
index 2a4294d..352e524 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -453,7 +453,7 @@ static inline void obd_ioctl_freedata(char *buf, int len)
  *					 __wake_up_common(q, ...);     (2.2)
  *					 spin_unlock(&q->lock, flags); (2.3)
  *
- *   OBD_FREE_PTR(obj);						  (3)
+ *   kfree(obj);						  (3)
  *
  * As l_wait_event() may "short-cut" execution and return without taking
  * wait-queue spin-lock, some additional synchronization is necessary to
diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h
index 3b6a2d7..c9c21d2 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -306,7 +306,7 @@ union ptlrpc_async_args {
 	/**
 	 * Scratchpad for passing args to completion interpreter. Users
 	 * cast to the struct of their choosing, and CLASSERT that this is
-	 * big enough.  For _tons_ of context, OBD_ALLOC a struct and store
+	 * big enough.  For _tons_ of context, kmalloc a struct and store
 	 * a pointer to it here.  The pointer_arg ensures this struct is at
 	 * least big enough for that.
 	 */
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index b610032..31ed248 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -694,7 +694,7 @@ out_och_free:
 	if (rc) {
 		if (och_p && *och_p) {
 			kfree(*och_p);
-			*och_p = NULL; /* OBD_FREE writes some magic there */
+			*och_p = NULL;
 			(*och_usecount)--;
 		}
 		mutex_unlock(&lli->lli_och_mutex);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index 84eb3da..9a10baf 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -1223,7 +1223,7 @@ int lprocfs_wr_evict_client(struct file *file, const char __user *buffer,
 		return -ENOMEM;
 
 	/*
-	 * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
+	 * kzalloc() will zero kbuf, but we only copy BUFLEN - 1
 	 * bytes into kbuf, to ensure that the string is NUL-terminated.
 	 * UUID_MAX should include a trailing NUL already.
 	 */
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 08/19] staging/lustre/fld: Replace OBD_ALLOC_GFP with kzalloc
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (6 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 07/19] staging/lustre: Remove references to OBD_ALLOC/FREE* in comments green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 09/19] staging/lustre: Convert lustre_cfg_new/free to use kzalloc/kfree green
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Part of effort to get rid of custom Lustre allocation macros.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/fld/fld_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c
index 1b1066b..5eeb36d 100644
--- a/drivers/staging/lustre/lustre/fld/fld_cache.c
+++ b/drivers/staging/lustre/lustre/fld/fld_cache.c
@@ -266,7 +266,7 @@ static void fld_cache_punch_hole(struct fld_cache *cache,
 	const u64 new_end  = range->lsr_end;
 	struct fld_cache_entry *fldt;
 
-	OBD_ALLOC_GFP(fldt, sizeof(*fldt), GFP_ATOMIC);
+	fldt = kzalloc(sizeof(*fldt), GFP_ATOMIC);
 	if (!fldt) {
 		kfree(f_new);
 		/* overlap is not allowed, so dont mess up list. */
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 09/19] staging/lustre: Convert lustre_cfg_new/free to use kzalloc/kfree
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (7 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 08/19] staging/lustre/fld: Replace OBD_ALLOC_GFP with kzalloc green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 10/19] staging/lustre/ptlrpc: Replace OBD_FREE_PTR with kfree green
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Part of effort of getting rid of custom Lustre allocation macros

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/lustre_cfg.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_cfg.h b/drivers/staging/lustre/lustre/include/lustre_cfg.h
index 7b385b8..c80d78e 100644
--- a/drivers/staging/lustre/lustre/include/lustre_cfg.h
+++ b/drivers/staging/lustre/lustre/include/lustre_cfg.h
@@ -231,8 +231,8 @@ static inline struct lustre_cfg *lustre_cfg_new(int cmd,
 	char *ptr;
 	int i;
 
-	OBD_ALLOC(lcfg, lustre_cfg_len(bufs->lcfg_bufcount,
-				       bufs->lcfg_buflen));
+	lcfg = kzalloc(lustre_cfg_len(bufs->lcfg_bufcount, bufs->lcfg_buflen),
+		       GFP_NOFS);
 	if (!lcfg)
 		return ERR_PTR(-ENOMEM);
 
@@ -254,7 +254,7 @@ static inline void lustre_cfg_free(struct lustre_cfg *lcfg)
 
 	len = lustre_cfg_len(lcfg->lcfg_bufcount, lcfg->lcfg_buflens);
 
-	OBD_FREE(lcfg, len);
+	kfree(lcfg);
 	return;
 }
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 10/19] staging/lustre/ptlrpc: Replace OBD_FREE_PTR with kfree
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (8 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 09/19] staging/lustre: Convert lustre_cfg_new/free to use kzalloc/kfree green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 11/19] staging/lustre: Replace last users of OBD_ALLOC/FREE_LARGE green
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Part of effort of getting rid of custom Lustre alloc/free macros

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
index 1d64ca7..34c7e28 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
@@ -298,6 +298,6 @@ static inline void tgt_mod_exit(void)
 static inline void ptlrpc_reqset_put(struct ptlrpc_request_set *set)
 {
 	if (atomic_dec_and_test(&set->set_refcount))
-		OBD_FREE_PTR(set);
+		kfree(set);
 }
 #endif /* PTLRPC_INTERNAL_H */
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 11/19] staging/lustre: Replace last users of OBD_ALLOC/FREE_LARGE
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (9 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 10/19] staging/lustre/ptlrpc: Replace OBD_FREE_PTR with kfree green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 12/19] staging/lustre: Remove stray bit of userland utils code green
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

OBD_ALLOC_LARGE is now replaced with libcfs_kvzalloc and
OBD_FREE_LARGE is now replaced with kvfree.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/lustre_lib.h | 2 +-
 drivers/staging/lustre/lustre/include/obd.h        | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
index 352e524..b380359 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -258,7 +258,7 @@ int obd_ioctl_popdata(void *arg, void *data, int len);
 
 static inline void obd_ioctl_freedata(char *buf, int len)
 {
-	OBD_FREE_LARGE(buf, len);
+	kvfree(buf);
 	return;
 }
 
diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index 1013c33..9c50ef1 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -728,8 +728,8 @@ static inline void oti_alloc_cookies(struct obd_trans_info *oti,
 	if (num_cookies == 1)
 		oti->oti_logcookies = &oti->oti_onecookie;
 	else
-		OBD_ALLOC_LARGE(oti->oti_logcookies,
-				num_cookies * sizeof(oti->oti_onecookie));
+		oti->oti_logcookies = libcfs_kvzalloc(num_cookies * sizeof(oti->oti_onecookie),
+						      GFP_NOFS);
 
 	oti->oti_numcookies = num_cookies;
 }
@@ -742,8 +742,8 @@ static inline void oti_free_cookies(struct obd_trans_info *oti)
 	if (oti->oti_logcookies == &oti->oti_onecookie)
 		LASSERT(oti->oti_numcookies == 1);
 	else
-		OBD_FREE_LARGE(oti->oti_logcookies,
-			       oti->oti_numcookies*sizeof(oti->oti_onecookie));
+		kvfree(oti->oti_logcookies);
+
 	oti->oti_logcookies = NULL;
 	oti->oti_numcookies = 0;
 }
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 12/19] staging/lustre: Remove stray bit of userland utils code
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (10 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 11/19] staging/lustre: Replace last users of OBD_ALLOC/FREE_LARGE green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 13/19] staging/lustre: Remove unused OBD_ALLOC* and OBD_FREE macros green
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

The UTILS are userland and I see it's causing confusion
with things being already converted to kmalloc,
so just remove it.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/obd_support.h | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 5ae35fa..d8feec7 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -551,23 +551,6 @@ __u64 obd_pages_max(void);
 #define OBD_ALLOC_FAIL_MASK ((1 << OBD_ALLOC_FAIL_BITS) - 1)
 #define OBD_ALLOC_FAIL_MULT (OBD_ALLOC_FAIL_MASK / 100)
 
-#if defined(LUSTRE_UTILS) /* this version is for utils only */
-#define __OBD_MALLOC_VERBOSE(ptr, cptab, cpt, size, flags)		      \
-do {									      \
-	(ptr) = (cptab) == NULL ?					      \
-		kmalloc(size, flags) :				      \
-		kmalloc_node(size, flags, cfs_cpt_spread_node(cptab, cpt));   \
-	if (unlikely((ptr) == NULL)) {					\
-		CERROR("kmalloc of '" #ptr "' (%d bytes) failed at %s:%d\n",  \
-		       (int)(size), __FILE__, __LINE__);		      \
-	} else {							      \
-		memset(ptr, 0, size);					      \
-		CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %d at %p\n",	      \
-		       (int)(size), ptr);				      \
-	}								      \
-} while (0)
-
-#else /* this version is for the kernel and liblustre */
 #define OBD_FREE_RTN0(ptr)						    \
 ({									    \
 	kfree(ptr);							\
@@ -589,7 +572,6 @@ do {									      \
 		OBD_ALLOC_POST(ptr, size, "kmalloced");		       \
 	}								     \
 } while (0)
-#endif
 
 #define OBD_ALLOC_GFP(ptr, size, gfp_mask)				      \
 	__OBD_MALLOC_VERBOSE(ptr, NULL, 0, size, gfp_mask)
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 13/19] staging/lustre: Remove unused OBD_ALLOC* and OBD_FREE macros
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (11 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 12/19] staging/lustre: Remove stray bit of userland utils code green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 14/19] staging/lustre: Remove memory allocation fault injection framework green
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

This removes now unused OBD_ALLOC, OBD_ALLOC_GFP, OBD_ALLOC_PTR,
OBD_ALLOC_LARGE and supporting infrastructure.
Also OBD_FREE, OBD_FREE_PTR, OBD_FREE_LARGE and supporting infrastructure.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../staging/lustre/lustre/include/obd_support.h    | 52 ----------------------
 1 file changed, 52 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index d8feec7..8a3323c 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -551,48 +551,6 @@ __u64 obd_pages_max(void);
 #define OBD_ALLOC_FAIL_MASK ((1 << OBD_ALLOC_FAIL_BITS) - 1)
 #define OBD_ALLOC_FAIL_MULT (OBD_ALLOC_FAIL_MASK / 100)
 
-#define OBD_FREE_RTN0(ptr)						    \
-({									    \
-	kfree(ptr);							\
-	(ptr) = NULL;							 \
-	0;								    \
-})
-
-#define __OBD_MALLOC_VERBOSE(ptr, cptab, cpt, size, flags)		      \
-do {									      \
-	(ptr) = (cptab) == NULL ?					      \
-		kmalloc(size, flags | __GFP_ZERO) :			      \
-		kmalloc_node(size, flags | __GFP_ZERO,			      \
-			     cfs_cpt_spread_node(cptab, cpt));		      \
-	if (likely((ptr) != NULL &&					   \
-		   (!HAS_FAIL_ALLOC_FLAG || obd_alloc_fail_rate == 0 ||       \
-		    !obd_alloc_fail(ptr, #ptr, "km", size,		    \
-				    __FILE__, __LINE__) ||		    \
-		    OBD_FREE_RTN0(ptr)))) {				    \
-		OBD_ALLOC_POST(ptr, size, "kmalloced");		       \
-	}								     \
-} while (0)
-
-#define OBD_ALLOC_GFP(ptr, size, gfp_mask)				      \
-	__OBD_MALLOC_VERBOSE(ptr, NULL, 0, size, gfp_mask)
-
-#define OBD_ALLOC(ptr, size) OBD_ALLOC_GFP(ptr, size, GFP_NOFS)
-#define OBD_ALLOC_WAIT(ptr, size) OBD_ALLOC_GFP(ptr, size, GFP_KERNEL)
-#define OBD_ALLOC_PTR(ptr) OBD_ALLOC(ptr, sizeof(*(ptr)))
-#define OBD_ALLOC_PTR_WAIT(ptr) OBD_ALLOC_WAIT(ptr, sizeof(*(ptr)))
-
-#define OBD_ALLOC_LARGE(ptr, size)					    \
-do {									  \
-	ptr = libcfs_kvzalloc(size, GFP_NOFS);				  \
-} while (0)
-
-#define OBD_FREE_LARGE(ptr, size)					     \
-do {									  \
-	(void)(size);							\
-	kvfree(ptr);							  \
-} while (0)
-
-
 #ifdef CONFIG_DEBUG_SLAB
 #define POISON(ptr, c, s) do {} while (0)
 #define POISON_PTR(ptr)  ((void)0)
@@ -610,14 +568,6 @@ do {									  \
 #define POISON_PAGE(page, val) do { } while (0)
 #endif
 
-#define OBD_FREE(ptr, size)						   \
-do {									  \
-	OBD_FREE_PRE(ptr, size, "kfreed");				    \
-	kfree(ptr);							\
-	POISON_PTR(ptr);						      \
-} while (0)
-
-
 #define OBD_FREE_RCU(ptr, size, handle)					      \
 do {									      \
 	struct portals_handle *__h = (handle);				      \
@@ -660,8 +610,6 @@ do {									      \
 #define OBD_SLAB_CPT_ALLOC_GFP(ptr, slab, cptab, cpt, size, flags)	      \
 	__OBD_SLAB_ALLOC_VERBOSE(ptr, slab, cptab, cpt, size, flags)
 
-#define OBD_FREE_PTR(ptr) OBD_FREE(ptr, sizeof(*(ptr)))
-
 #define OBD_SLAB_FREE(ptr, slab, size)					\
 do {									  \
 	OBD_FREE_PRE(ptr, size, "slab-freed");				\
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 14/19] staging/lustre: Remove memory allocation fault injection framework
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (12 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 13/19] staging/lustre: Remove unused OBD_ALLOC* and OBD_FREE macros green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 15/19] staging/lustre: Remove lustre used memory tracking framework green
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Lustre memory allocation wrappers also included a fault injection
framework that's totally redundant, since in-kernel offering is
actually superior to what we had.
So let's remove it.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/obd_support.h | 20 +-------------------
 drivers/staging/lustre/lustre/obdclass/class_obd.c  | 21 ---------------------
 2 files changed, 1 insertion(+), 40 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 8a3323c..3d92f19 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -66,13 +66,8 @@ extern unsigned int obd_sync_filter;
 extern unsigned int obd_max_dirty_pages;
 extern atomic_t obd_dirty_pages;
 extern atomic_t obd_dirty_transit_pages;
-extern unsigned int obd_alloc_fail_rate;
 extern char obd_jobid_var[];
 
-/* lvfs.c */
-int obd_alloc_fail(const void *ptr, const char *name, const char *type,
-		   size_t size, const char *file, int line);
-
 /* Some hash init argument constants */
 #define HASH_POOLS_BKT_BITS 3
 #define HASH_POOLS_CUR_BITS 3
@@ -428,8 +423,6 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
 
 #define OBD_FAIL_LPROC_REMOVE	    0xB00
 
-#define OBD_FAIL_GENERAL_ALLOC	   0xC00
-
 #define OBD_FAIL_SEQ		     0x1000
 #define OBD_FAIL_SEQ_QUERY_NET	   0x1001
 #define OBD_FAIL_SEQ_EXHAUST		 0x1002
@@ -545,12 +538,6 @@ __u64 obd_pages_max(void);
 
 #endif /* !OBD_DEBUG_MEMUSAGE */
 
-#define HAS_FAIL_ALLOC_FLAG OBD_FAIL_CHECK(OBD_FAIL_GENERAL_ALLOC)
-
-#define OBD_ALLOC_FAIL_BITS 24
-#define OBD_ALLOC_FAIL_MASK ((1 << OBD_ALLOC_FAIL_BITS) - 1)
-#define OBD_ALLOC_FAIL_MULT (OBD_ALLOC_FAIL_MASK / 100)
-
 #ifdef CONFIG_DEBUG_SLAB
 #define POISON(ptr, c, s) do {} while (0)
 #define POISON_PTR(ptr)  ((void)0)
@@ -596,13 +583,8 @@ do {									      \
 		kmem_cache_alloc(slab, type | __GFP_ZERO) :		\
 		kmem_cache_alloc_node(slab, type | __GFP_ZERO,		\
 				      cfs_cpt_spread_node(cptab, cpt));	\
-	if (likely((ptr) != NULL &&					   \
-		   (!HAS_FAIL_ALLOC_FLAG || obd_alloc_fail_rate == 0 ||       \
-		    !obd_alloc_fail(ptr, #ptr, "slab-", size,		 \
-				    __FILE__, __LINE__) ||		    \
-		    OBD_SLAB_FREE_RTN0(ptr, slab)))) {			\
+	if (likely(ptr))						\
 		OBD_ALLOC_POST(ptr, size, "slab-alloced");		    \
-	}								     \
 } while (0)
 
 #define OBD_SLAB_ALLOC_GFP(ptr, slab, size, flags)			      \
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index b151154..fb4138c 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -64,8 +64,6 @@ EXPORT_SYMBOL(obd_pages);
 static DEFINE_SPINLOCK(obd_updatemax_lock);
 
 /* The following are visible and mutable through /proc/sys/lustre/. */
-unsigned int obd_alloc_fail_rate;
-EXPORT_SYMBOL(obd_alloc_fail_rate);
 unsigned int obd_debug_peer_on_timeout;
 EXPORT_SYMBOL(obd_debug_peer_on_timeout);
 unsigned int obd_dump_on_timeout;
@@ -132,25 +130,6 @@ int lustre_get_jobid(char *jobid)
 }
 EXPORT_SYMBOL(lustre_get_jobid);
 
-int obd_alloc_fail(const void *ptr, const char *name, const char *type,
-		   size_t size, const char *file, int line)
-{
-	if (ptr == NULL ||
-	    (cfs_rand() & OBD_ALLOC_FAIL_MASK) < obd_alloc_fail_rate) {
-		CERROR("%s%salloc of %s (%llu bytes) failed at %s:%d\n",
-		       ptr ? "force " : "", type, name, (__u64)size, file,
-		       line);
-		CERROR("%llu total bytes and %llu total pages"
-			" (%llu bytes) allocated by Lustre\n",
-		       obd_memory_sum(),
-		       obd_pages_sum() << PAGE_CACHE_SHIFT,
-		       obd_pages_sum());
-		return 1;
-	}
-	return 0;
-}
-EXPORT_SYMBOL(obd_alloc_fail);
-
 static inline void obd_data2conn(struct lustre_handle *conn,
 				 struct obd_ioctl_data *data)
 {
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 15/19] staging/lustre: Remove lustre used memory tracking framework
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (13 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 14/19] staging/lustre: Remove memory allocation fault injection framework green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 16/19] staging/lustre: remove obd_memory stats counter green
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Lustre memory allocation framework has a feature to track amount
of allocated memory, but since it's not being used consistently anymore
and is on the way out in general, just remove it.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../staging/lustre/lustre/include/obd_support.h    | 60 +-------------------
 drivers/staging/lustre/lustre/obdclass/class_obd.c | 64 ----------------------
 drivers/staging/lustre/lustre/ptlrpc/pinger.c      |  2 -
 3 files changed, 1 insertion(+), 125 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 3d92f19..62d76b5 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -494,50 +494,6 @@ extern char obd_jobid_var[];
 #define OBD_FAIL_ONCE			   CFS_FAIL_ONCE
 #define OBD_FAILED			      CFS_FAILED
 
-void obd_update_maxusage(void);
-
-#define obd_memory_add(size)						  \
-	lprocfs_counter_add(obd_memory, OBD_MEMORY_STAT, (long)(size))
-#define obd_memory_sub(size)						  \
-	lprocfs_counter_sub(obd_memory, OBD_MEMORY_STAT, (long)(size))
-#define obd_memory_sum()						      \
-	lprocfs_stats_collector(obd_memory, OBD_MEMORY_STAT,		  \
-				LPROCFS_FIELDS_FLAGS_SUM)
-#define obd_pages_add(order)						  \
-	lprocfs_counter_add(obd_memory, OBD_MEMORY_PAGES_STAT,		\
-			    (long)(1 << (order)))
-#define obd_pages_sub(order)						  \
-	lprocfs_counter_sub(obd_memory, OBD_MEMORY_PAGES_STAT,		\
-			    (long)(1 << (order)))
-#define obd_pages_sum()						       \
-	lprocfs_stats_collector(obd_memory, OBD_MEMORY_PAGES_STAT,	    \
-				LPROCFS_FIELDS_FLAGS_SUM)
-
-__u64 obd_memory_max(void);
-__u64 obd_pages_max(void);
-
-#define OBD_DEBUG_MEMUSAGE (1)
-
-#if OBD_DEBUG_MEMUSAGE
-#define OBD_ALLOC_POST(ptr, size, name)				 \
-		obd_memory_add(size);				   \
-		CDEBUG(D_MALLOC, name " '" #ptr "': %d at %p.\n",       \
-		       (int)(size), ptr)
-
-#define OBD_FREE_PRE(ptr, size, name)				   \
-	LASSERT(ptr);						   \
-	obd_memory_sub(size);					   \
-	CDEBUG(D_MALLOC, name " '" #ptr "': %d at %p.\n",	       \
-	       (int)(size), ptr);				       \
-	POISON(ptr, 0x5a, size)
-
-#else /* !OBD_DEBUG_MEMUSAGE */
-
-#define OBD_ALLOC_POST(ptr, size, name) ((void)0)
-#define OBD_FREE_PRE(ptr, size, name)   ((void)0)
-
-#endif /* !OBD_DEBUG_MEMUSAGE */
-
 #ifdef CONFIG_DEBUG_SLAB
 #define POISON(ptr, c, s) do {} while (0)
 #define POISON_PTR(ptr)  ((void)0)
@@ -583,8 +539,6 @@ do {									      \
 		kmem_cache_alloc(slab, type | __GFP_ZERO) :		\
 		kmem_cache_alloc_node(slab, type | __GFP_ZERO,		\
 				      cfs_cpt_spread_node(cptab, cpt));	\
-	if (likely(ptr))						\
-		OBD_ALLOC_POST(ptr, size, "slab-alloced");		    \
 } while (0)
 
 #define OBD_SLAB_ALLOC_GFP(ptr, slab, size, flags)			      \
@@ -594,7 +548,6 @@ do {									      \
 
 #define OBD_SLAB_FREE(ptr, slab, size)					\
 do {									  \
-	OBD_FREE_PRE(ptr, size, "slab-freed");				\
 	kmem_cache_free(slab, ptr);					\
 	POISON_PTR(ptr);						      \
 } while (0)
@@ -629,17 +582,7 @@ do {									      \
 	(ptr) = (cptab) == NULL ?					      \
 		alloc_page(gfp_mask) :				      \
 		alloc_pages_node(cfs_cpt_spread_node(cptab, cpt), gfp_mask, 0);\
-	if (unlikely((ptr) == NULL)) {					\
-		CERROR("alloc_pages of '" #ptr "' %d page(s) / %llu bytes "\
-		       "failed\n", (int)1,				    \
-		       (__u64)(1 << PAGE_CACHE_SHIFT));			 \
-		CERROR("%llu total bytes and %llu total pages "	   \
-		       "(%llu bytes) allocated by Lustre\n",		      \
-		       obd_memory_sum(),				      \
-		       obd_pages_sum() << PAGE_CACHE_SHIFT,		     \
-		       obd_pages_sum());				       \
-	} else {							      \
-		obd_pages_add(0);					     \
+	if (ptr) {					\
 		CDEBUG(D_MALLOC, "alloc_pages '" #ptr "': %d page(s) / "      \
 		       "%llu bytes at %p.\n",				\
 		       (int)1,						\
@@ -655,7 +598,6 @@ do {									      \
 #define OBD_PAGE_FREE(ptr)						    \
 do {									  \
 	LASSERT(ptr);							 \
-	obd_pages_sub(0);						     \
 	CDEBUG(D_MALLOC, "free_pages '" #ptr "': %d page(s) / %llu bytes " \
 	       "at %p.\n",						    \
 	       (int)1, (__u64)(1 << PAGE_CACHE_SHIFT),			  \
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index fb4138c..32daefb 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -53,16 +53,6 @@ EXPORT_SYMBOL(obd_devs);
 struct list_head obd_types;
 DEFINE_RWLOCK(obd_dev_lock);
 
-__u64 obd_max_pages;
-EXPORT_SYMBOL(obd_max_pages);
-__u64 obd_max_alloc;
-EXPORT_SYMBOL(obd_max_alloc);
-__u64 obd_alloc;
-EXPORT_SYMBOL(obd_alloc);
-__u64 obd_pages;
-EXPORT_SYMBOL(obd_pages);
-static DEFINE_SPINLOCK(obd_updatemax_lock);
-
 /* The following are visible and mutable through /proc/sys/lustre/. */
 unsigned int obd_debug_peer_on_timeout;
 EXPORT_SYMBOL(obd_debug_peer_on_timeout);
@@ -572,54 +562,12 @@ static int __init init_obdclass(void)
 	return err;
 }
 
-void obd_update_maxusage(void)
-{
-	__u64 max1, max2;
-
-	max1 = obd_pages_sum();
-	max2 = obd_memory_sum();
-
-	spin_lock(&obd_updatemax_lock);
-	if (max1 > obd_max_pages)
-		obd_max_pages = max1;
-	if (max2 > obd_max_alloc)
-		obd_max_alloc = max2;
-	spin_unlock(&obd_updatemax_lock);
-}
-EXPORT_SYMBOL(obd_update_maxusage);
-
-__u64 obd_memory_max(void)
-{
-	__u64 ret;
-
-	spin_lock(&obd_updatemax_lock);
-	ret = obd_max_alloc;
-	spin_unlock(&obd_updatemax_lock);
-
-	return ret;
-}
-EXPORT_SYMBOL(obd_memory_max);
-
-__u64 obd_pages_max(void)
-{
-	__u64 ret;
-
-	spin_lock(&obd_updatemax_lock);
-	ret = obd_max_pages;
-	spin_unlock(&obd_updatemax_lock);
-
-	return ret;
-}
-EXPORT_SYMBOL(obd_pages_max);
-
 /* liblustre doesn't call cleanup_obdclass, apparently.  we carry on in this
  * ifdef to the end of the file to cover module and versioning goo.*/
 static void cleanup_obdclass(void)
 {
 	int i;
 	int lustre_unregister_fs(void);
-	__u64 memory_leaked, pages_leaked;
-	__u64 memory_max, pages_max;
 
 	lustre_unregister_fs();
 
@@ -645,19 +593,7 @@ static void cleanup_obdclass(void)
 	class_exit_uuidlist();
 	obd_zombie_impexp_stop();
 
-	memory_leaked = obd_memory_sum();
-	pages_leaked = obd_pages_sum();
-
-	memory_max = obd_memory_max();
-	pages_max = obd_pages_max();
-
 	lprocfs_free_stats(&obd_memory);
-	CDEBUG((memory_leaked) ? D_ERROR : D_INFO,
-	       "obd_memory max: %llu, leaked: %llu\n",
-	       memory_max, memory_leaked);
-	CDEBUG((pages_leaked) ? D_ERROR : D_INFO,
-	       "obd_memory_pages max: %llu, leaked: %llu\n",
-	       pages_max, pages_leaked);
 }
 
 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
index d3aea4a..6cd4cfa 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
@@ -266,8 +266,6 @@ static int ptlrpc_pinger_main(void *arg)
 				ptlrpc_update_next_ping(imp, 0);
 		}
 		mutex_unlock(&pinger_mutex);
-		/* update memory usage info */
-		obd_update_maxusage();
 
 		/* Wait until the next ping time, or until we're stopped. */
 		time_to_next_wake = pinger_check_timeout(this_ping);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 16/19] staging/lustre: remove obd_memory stats counter
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (14 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 15/19] staging/lustre: Remove lustre used memory tracking framework green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 17/19] staging/lustre: Remove IS_SERVER and all users green
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Now that we no longer track allocated memory, remove
obd_memory statistics counter and all references to it everywhere

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/obd_support.h    |  7 -------
 drivers/staging/lustre/lustre/obdclass/class_obd.c     | 18 ------------------
 .../staging/lustre/lustre/obdclass/lprocfs_counters.c  |  9 ---------
 .../staging/lustre/lustre/obdclass/lprocfs_status.c    |  2 +-
 4 files changed, 1 insertion(+), 35 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 62d76b5..80ab85d 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -43,13 +43,6 @@
 #include "lprocfs_status.h"
 
 /* global variables */
-extern struct lprocfs_stats *obd_memory;
-enum {
-	OBD_MEMORY_STAT = 0,
-	OBD_MEMORY_PAGES_STAT = 1,
-	OBD_STATS_NUM,
-};
-
 extern unsigned int obd_debug_peer_on_timeout;
 extern unsigned int obd_dump_on_timeout;
 extern unsigned int obd_dump_on_eviction;
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 32daefb..39bf734 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -487,22 +487,6 @@ static int __init init_obdclass(void)
 	spin_lock_init(&obd_types_lock);
 	obd_zombie_impexp_init();
 
-	obd_memory = lprocfs_alloc_stats(OBD_STATS_NUM,
-					 LPROCFS_STATS_FLAG_NONE |
-					 LPROCFS_STATS_FLAG_IRQ_SAFE);
-
-	if (obd_memory == NULL) {
-		CERROR("kmalloc of 'obd_memory' failed\n");
-		return -ENOMEM;
-	}
-
-	lprocfs_counter_init(obd_memory, OBD_MEMORY_STAT,
-			     LPROCFS_CNTR_AVGMINMAX,
-			     "memused", "bytes");
-	lprocfs_counter_init(obd_memory, OBD_MEMORY_PAGES_STAT,
-			     LPROCFS_CNTR_AVGMINMAX,
-			     "pagesused", "pages");
-
 	err = obd_init_checks();
 	if (err == -EOVERFLOW)
 		return err;
@@ -592,8 +576,6 @@ static void cleanup_obdclass(void)
 	class_handle_cleanup();
 	class_exit_uuidlist();
 	obd_zombie_impexp_stop();
-
-	lprocfs_free_stats(&obd_memory);
 }
 
 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c
index 1f0004c..6acc4a1 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c
@@ -41,9 +41,6 @@
 #include "../include/lprocfs_status.h"
 #include "../include/obd_support.h"
 
-struct lprocfs_stats *obd_memory;
-EXPORT_SYMBOL(obd_memory);
-
 void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount)
 {
 	struct lprocfs_counter		*percpu_cntr;
@@ -74,9 +71,6 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount)
 		 * ldlm_pool_shrink(), which calls lprocfs_counter_add().
 		 * LU-1727.
 		 *
-		 * Only obd_memory uses LPROCFS_STATS_FLAG_IRQ_SAFE
-		 * flag, because it needs accurate counting lest memory leak
-		 * check reports error.
 		 */
 		if (in_interrupt() &&
 		    (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
@@ -124,9 +118,6 @@ void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, long amount)
 		 * softirq context here, use separate counter for that.
 		 * bz20650.
 		 *
-		 * Only obd_memory uses LPROCFS_STATS_FLAG_IRQ_SAFE
-		 * flag, because it needs accurate counting lest memory leak
-		 * check reports error.
 		 */
 		if (in_interrupt() &&
 		    (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 08d1f0e..8d2a523 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1082,7 +1082,7 @@ struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num,
 			goto fail;
 		stats->ls_biggest_alloc_num = 1;
 	} else if ((flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0) {
-		/* alloc all percpu data, currently only obd_memory use this */
+		/* alloc all percpu data */
 		for (i = 0; i < num_entry; ++i)
 			if (lprocfs_stats_alloc_one(stats, i) < 0)
 				goto fail;
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 17/19] staging/lustre: Remove IS_SERVER and all users
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (15 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 16/19] staging/lustre: remove obd_memory stats counter green
@ 2015-09-16  0:30 ` green
  2015-09-16  5:35   ` Sudip Mukherjee
  2015-09-16  0:30 ` [PATCH 18/19] staging/lustre: remove IS_MDS|IS_OST|IS_MGS defines and users green
  2015-09-16  0:30 ` [PATCH 19/19] staging/lustre: Remove server defines from lustre_disk.h green
  18 siblings, 1 reply; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Since the client can never be server, this is all dead code.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../staging/lustre/lustre/include/lustre_disk.h    |  2 -
 drivers/staging/lustre/lustre/mgc/mgc_request.c    | 37 ++--------
 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 85 ++++------------------
 3 files changed, 20 insertions(+), 104 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h
index 131985d..3f404a2 100644
--- a/drivers/staging/lustre/lustre/include/lustre_disk.h
+++ b/drivers/staging/lustre/lustre/include/lustre_disk.h
@@ -180,8 +180,6 @@ struct lustre_disk_data {
 #define IS_MDT(data)    ((data)->lsi_flags & LDD_F_SV_TYPE_MDT)
 #define IS_OST(data)    ((data)->lsi_flags & LDD_F_SV_TYPE_OST)
 #define IS_MGS(data)    ((data)->lsi_flags & LDD_F_SV_TYPE_MGS)
-#define IS_SERVER(data) ((data)->lsi_flags & (LDD_F_SV_TYPE_MGS | \
-			 LDD_F_SV_TYPE_MDT | LDD_F_SV_TYPE_OST))
 #define MT_STR(data)    mt_str((data)->ldd_mount_type)
 
 /* Make the mdt/ost server obd name based on the filesystem name */
diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index 1bcf946..76c3ded 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -248,7 +248,6 @@ static struct config_llog_data *config_recover_log_add(struct obd_device *obd,
 	struct super_block *sb)
 {
 	struct config_llog_instance lcfg = *cfg;
-	struct lustre_sb_info *lsi = s2lsi(sb);
 	struct config_llog_data *cld;
 	char logname[32];
 
@@ -263,14 +262,8 @@ static struct config_llog_data *config_recover_log_add(struct obd_device *obd,
 	 * where only clients are notified if one of cmd server restarts */
 	LASSERT(strlen(fsname) < sizeof(logname) / 2);
 	strcpy(logname, fsname);
-	if (IS_SERVER(lsi)) { /* mdt */
-		LASSERT(lcfg.cfg_instance == NULL);
-		lcfg.cfg_instance = sb;
-		strcat(logname, "-mdtir");
-	} else {
-		LASSERT(lcfg.cfg_instance != NULL);
-		strcat(logname, "-cliir");
-	}
+	LASSERT(lcfg.cfg_instance);
+	strcat(logname, "-cliir");
 
 	cld = do_config_log_add(obd, logname, CONFIG_T_RECOVER, &lcfg, sb);
 	return cld;
@@ -899,12 +892,6 @@ static int mgc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm,
 	req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER, 0);
 	ptlrpc_request_set_replen(req);
 
-	/* check if this is server or client */
-	if (cld->cld_cfg.cfg_sb) {
-		struct lustre_sb_info *lsi = s2lsi(cld->cld_cfg.cfg_sb);
-		if (lsi && IS_SERVER(lsi))
-			short_limit = 1;
-	}
 	/* Limit how long we will wait for the enqueue to complete */
 	req->rq_delay_limit = short_limit ? 5 : MGC_ENQUEUE_LIMIT;
 	rc = ldlm_cli_enqueue(exp, &req, &einfo, &cld->cld_resid, NULL, flags,
@@ -1112,7 +1099,6 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
 				  void *data, int datalen, bool mne_swab)
 {
 	struct config_llog_instance *cfg = &cld->cld_cfg;
-	struct lustre_sb_info       *lsi = s2lsi(cfg->cfg_sb);
 	struct mgs_nidtbl_entry *entry;
 	struct lustre_cfg       *lcfg;
 	struct lustre_cfg_bufs   bufs;
@@ -1131,21 +1117,10 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
 	if (!inst)
 		return -ENOMEM;
 
-	if (!IS_SERVER(lsi)) {
-		pos = snprintf(inst, PAGE_CACHE_SIZE, "%p", cfg->cfg_instance);
-		if (pos >= PAGE_CACHE_SIZE) {
-			kfree(inst);
-			return -E2BIG;
-		}
-	} else {
-		LASSERT(IS_MDT(lsi));
-		rc = server_name2svname(lsi->lsi_svname, inst, NULL,
-					PAGE_CACHE_SIZE);
-		if (rc) {
-			kfree(inst);
-			return -EINVAL;
-		}
-		pos = strlen(inst);
+	pos = snprintf(inst, PAGE_CACHE_SIZE, "%p", cfg->cfg_instance);
+	if (pos >= PAGE_CACHE_SIZE) {
+		kfree(inst);
+		return -E2BIG;
 	}
 
 	++pos;
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 3c66dbd..1db4669 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -216,29 +216,10 @@ int lustre_start_mgc(struct super_block *sb)
 
 	LASSERT(lsi->lsi_lmd);
 
-	/* Find the first non-lo MGS nid for our MGC name */
-	if (IS_SERVER(lsi)) {
-		/* mount -o mgsnode=nid */
-		ptr = lsi->lsi_lmd->lmd_mgs;
-		if (lsi->lsi_lmd->lmd_mgs &&
-		    (class_parse_nid(lsi->lsi_lmd->lmd_mgs, &nid, &ptr) == 0)) {
-			i++;
-		} else if (IS_MGS(lsi)) {
-			lnet_process_id_t id;
-			while ((rc = LNetGetId(i++, &id)) != -ENOENT) {
-				if (LNET_NETTYP(LNET_NIDNET(id.nid)) == LOLND)
-					continue;
-				nid = id.nid;
-				i++;
-				break;
-			}
-		}
-	} else { /* client */
-		/* Use nids from mount line: uml1,1@elan:uml2,2@elan:/lustre */
-		ptr = lsi->lsi_lmd->lmd_dev;
-		if (class_parse_nid(ptr, &nid, &ptr) == 0)
-			i++;
-	}
+	/* Use nids from mount line: uml1,1@elan:uml2,2@elan:/lustre */
+	ptr = lsi->lsi_lmd->lmd_dev;
+	if (class_parse_nid(ptr, &nid, &ptr) == 0)
+		i++;
 	if (i == 0) {
 		CERROR("No valid MGS nids found.\n");
 		return -EINVAL;
@@ -326,45 +307,15 @@ int lustre_start_mgc(struct super_block *sb)
 
 	/* Add the primary nids for the MGS */
 	i = 0;
-	if (IS_SERVER(lsi)) {
-		ptr = lsi->lsi_lmd->lmd_mgs;
-		if (IS_MGS(lsi)) {
-			/* Use local nids (including LO) */
-			lnet_process_id_t id;
-			while ((rc = LNetGetId(i++, &id)) != -ENOENT) {
-				rc = do_lcfg(mgcname, id.nid,
-					     LCFG_ADD_UUID, niduuid,
-					     NULL, NULL, NULL);
-			}
-		} else {
-			/* Use mgsnode= nids */
-			/* mount -o mgsnode=nid */
-			if (lsi->lsi_lmd->lmd_mgs) {
-				ptr = lsi->lsi_lmd->lmd_mgs;
-			} else if (class_find_param(ptr, PARAM_MGSNODE,
-						    &ptr) != 0) {
-				CERROR("No MGS nids given.\n");
-				rc = -EINVAL;
-				goto out_free;
-			}
-			while (class_parse_nid(ptr, &nid, &ptr) == 0) {
-				rc = do_lcfg(mgcname, nid,
-					     LCFG_ADD_UUID, niduuid,
-					     NULL, NULL, NULL);
-				i++;
-			}
-		}
-	} else { /* client */
-		/* Use nids from mount line: uml1,1@elan:uml2,2@elan:/lustre */
-		ptr = lsi->lsi_lmd->lmd_dev;
-		while (class_parse_nid(ptr, &nid, &ptr) == 0) {
-			rc = do_lcfg(mgcname, nid,
-				     LCFG_ADD_UUID, niduuid, NULL, NULL, NULL);
-			i++;
-			/* Stop at the first failover nid */
-			if (*ptr == ':')
-				break;
-		}
+	/* Use nids from mount line: uml1,1@elan:uml2,2@elan:/lustre */
+	ptr = lsi->lsi_lmd->lmd_dev;
+	while (class_parse_nid(ptr, &nid, &ptr) == 0) {
+		rc = do_lcfg(mgcname, nid,
+			     LCFG_ADD_UUID, niduuid, NULL, NULL, NULL);
+		i++;
+		/* Stop at the first failover nid */
+		if (*ptr == ':')
+			break;
 	}
 	if (i == 0) {
 		CERROR("No valid MGS nids found.\n");
@@ -610,14 +561,6 @@ int lustre_put_lsi(struct super_block *sb)
 
 	CDEBUG(D_MOUNT, "put %p %d\n", sb, atomic_read(&lsi->lsi_mounts));
 	if (atomic_dec_and_test(&lsi->lsi_mounts)) {
-		if (IS_SERVER(lsi) && lsi->lsi_osd_exp) {
-			lu_device_put(&lsi->lsi_dt_dev->dd_lu_dev);
-			lsi->lsi_osd_exp->exp_obd->obd_lvfs_ctxt.dt = NULL;
-			lsi->lsi_dt_dev = NULL;
-			obd_disconnect(lsi->lsi_osd_exp);
-			/* wait till OSD is gone */
-			obd_zombie_barrier();
-		}
 		lustre_free_lsi(sb);
 		return 1;
 	}
@@ -1267,7 +1210,7 @@ static void lustre_kill_super(struct super_block *sb)
 {
 	struct lustre_sb_info *lsi = s2lsi(sb);
 
-	if (kill_super_cb && lsi && !IS_SERVER(lsi))
+	if (kill_super_cb && lsi)
 		(*kill_super_cb)(sb);
 
 	kill_anon_super(sb);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 18/19] staging/lustre: remove IS_MDS|IS_OST|IS_MGS defines and users
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (16 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 17/19] staging/lustre: Remove IS_SERVER and all users green
@ 2015-09-16  0:30 ` green
  2015-09-16  0:30 ` [PATCH 19/19] staging/lustre: Remove server defines from lustre_disk.h green
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

These could only happen on the server, so they make no sense
on the client.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/include/lustre_disk.h | 3 ---
 drivers/staging/lustre/lustre/mgc/mgc_request.c     | 7 -------
 drivers/staging/lustre/lustre/obdclass/obd_mount.c  | 6 ------
 3 files changed, 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h
index 3f404a2..859007c 100644
--- a/drivers/staging/lustre/lustre/include/lustre_disk.h
+++ b/drivers/staging/lustre/lustre/include/lustre_disk.h
@@ -177,9 +177,6 @@ struct lustre_disk_data {
 };
 
 
-#define IS_MDT(data)    ((data)->lsi_flags & LDD_F_SV_TYPE_MDT)
-#define IS_OST(data)    ((data)->lsi_flags & LDD_F_SV_TYPE_OST)
-#define IS_MGS(data)    ((data)->lsi_flags & LDD_F_SV_TYPE_MGS)
 #define MT_STR(data)    mt_str((data)->ldd_mount_type)
 
 /* Make the mdt/ost server obd name based on the filesystem name */
diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index 76c3ded..f254bb1 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -251,13 +251,6 @@ static struct config_llog_data *config_recover_log_add(struct obd_device *obd,
 	struct config_llog_data *cld;
 	char logname[32];
 
-	if (IS_OST(lsi))
-		return NULL;
-
-	/* for osp-on-ost, see lustre_start_osp() */
-	if (IS_MDT(lsi) && lcfg.cfg_instance)
-		return NULL;
-
 	/* we have to use different llog for clients and mdts for cmd
 	 * where only clients are notified if one of cmd server restarts */
 	LASSERT(strlen(fsname) < sizeof(logname) / 2);
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 1db4669..16009a6 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -281,12 +281,6 @@ int lustre_start_mgc(struct super_block *sb)
 		}
 
 		recov_bk = 0;
-		/* If we are restarting the MGS, don't try to keep the MGC's
-		   old connection, or registration will fail. */
-		if (IS_MGS(lsi)) {
-			CDEBUG(D_MOUNT, "New MGS with live MGC\n");
-			recov_bk = 1;
-		}
 
 		/* Try all connections, but only once (again).
 		   We don't want to block another target from starting
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 19/19] staging/lustre: Remove server defines from lustre_disk.h
  2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
                   ` (17 preceding siblings ...)
  2015-09-16  0:30 ` [PATCH 18/19] staging/lustre: remove IS_MDS|IS_OST|IS_MGS defines and users green
@ 2015-09-16  0:30 ` green
  18 siblings, 0 replies; 22+ messages in thread
From: green @ 2015-09-16  0:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger
  Cc: Linux Kernel Mailing List, Oleg Drokin, Oleg Drokin

From: Oleg Drokin <green@linuxhacker.ru>

Take initial stab at removing server-disk related defines that
client does not need.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../staging/lustre/lustre/include/lustre_disk.h    | 137 ---------------------
 .../staging/lustre/lustre/obdclass/llog_internal.h |   8 --
 2 files changed, 145 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h
index 859007c..ec33259 100644
--- a/drivers/staging/lustre/lustre/include/lustre_disk.h
+++ b/drivers/staging/lustre/lustre/include/lustre_disk.h
@@ -52,24 +52,6 @@
 #include "../../include/linux/lnet/types.h"
 #include <linux/backing-dev.h>
 
-/****************** on-disk files *********************/
-
-#define MDT_LOGS_DIR		"LOGS"  /* COMPAT_146 */
-#define MOUNT_CONFIGS_DIR	"CONFIGS"
-#define CONFIGS_FILE		"mountdata"
-/** Persistent mount data are stored on the disk in this file. */
-#define MOUNT_DATA_FILE		MOUNT_CONFIGS_DIR"/"CONFIGS_FILE
-#define LAST_RCVD		"last_rcvd"
-#define LOV_OBJID		"lov_objid"
-#define LOV_OBJSEQ		"lov_objseq"
-#define HEALTH_CHECK		"health_check"
-#define CAPA_KEYS		"capa_keys"
-#define CHANGELOG_USERS		"changelog_users"
-#define MGS_NIDTBL_DIR		"NIDTBL_VERSIONS"
-#define QMT_DIR			"quota_master"
-#define QSD_DIR			"quota_slave"
-#define HSM_ACTIONS		"hsm_actions"
-
 /****************** persistent mount data *********************/
 
 #define LDD_F_SV_TYPE_MDT   0x0001
@@ -79,125 +61,6 @@
 			    LDD_F_SV_TYPE_OST  | \
 			    LDD_F_SV_TYPE_MGS)
 #define LDD_F_SV_ALL	0x0008
-/** need an index assignment */
-#define LDD_F_NEED_INDEX    0x0010
-/** never registered */
-#define LDD_F_VIRGIN	0x0020
-/** update the config logs for this server */
-#define LDD_F_UPDATE	0x0040
-/** rewrite the LDD */
-#define LDD_F_REWRITE_LDD   0x0080
-/** regenerate config logs for this fs or server */
-#define LDD_F_WRITECONF     0x0100
-/** COMPAT_14 */
-#define LDD_F_UPGRADE14     0x0200
-/** process as lctl conf_param */
-#define LDD_F_PARAM	 0x0400
-/** all nodes are specified as service nodes */
-#define LDD_F_NO_PRIMNODE   0x1000
-/** IR enable flag */
-#define LDD_F_IR_CAPABLE    0x2000
-/** the MGS refused to register the target. */
-#define LDD_F_ERROR	 0x4000
-/** process at lctl conf_param */
-#define LDD_F_PARAM2		0x8000
-
-/* opc for target register */
-#define LDD_F_OPC_REG   0x10000000
-#define LDD_F_OPC_UNREG 0x20000000
-#define LDD_F_OPC_READY 0x40000000
-#define LDD_F_OPC_MASK  0xf0000000
-
-#define LDD_F_ONDISK_MASK  (LDD_F_SV_TYPE_MASK)
-
-#define LDD_F_MASK	  0xFFFF
-
-enum ldd_mount_type {
-	LDD_MT_EXT3 = 0,
-	LDD_MT_LDISKFS,
-	LDD_MT_SMFS,
-	LDD_MT_REISERFS,
-	LDD_MT_LDISKFS2,
-	LDD_MT_ZFS,
-	LDD_MT_LAST
-};
-
-static inline char *mt_str(enum ldd_mount_type mt)
-{
-	static char *mount_type_string[] = {
-		"ext3",
-		"ldiskfs",
-		"smfs",
-		"reiserfs",
-		"ldiskfs2",
-		"zfs",
-	};
-	return mount_type_string[mt];
-}
-
-static inline char *mt_type(enum ldd_mount_type mt)
-{
-	static char *mount_type_string[] = {
-		"osd-ldiskfs",
-		"osd-ldiskfs",
-		"osd-smfs",
-		"osd-reiserfs",
-		"osd-ldiskfs",
-		"osd-zfs",
-	};
-	return mount_type_string[mt];
-}
-
-#define LDD_INCOMPAT_SUPP 0
-#define LDD_ROCOMPAT_SUPP 0
-
-#define LDD_MAGIC 0x1dd00001
-
-/* On-disk configuration file. In host-endian order. */
-struct lustre_disk_data {
-	__u32      ldd_magic;
-	__u32      ldd_feature_compat;  /* compatible feature flags */
-	__u32      ldd_feature_rocompat;/* read-only compatible feature flags */
-	__u32      ldd_feature_incompat;/* incompatible feature flags */
-
-	__u32      ldd_config_ver;      /* config rewrite count - not used */
-	__u32      ldd_flags;	   /* LDD_SV_TYPE */
-	__u32      ldd_svindex;	 /* server index (0001), must match
-					   svname */
-	__u32      ldd_mount_type;      /* target fs type LDD_MT_* */
-	char       ldd_fsname[64];      /* filesystem this server is part of,
-					   MTI_NAME_MAXLEN */
-	char       ldd_svname[64];      /* this server's name (lustre-mdt0001)*/
-	__u8       ldd_uuid[40];	/* server UUID (COMPAT_146) */
-
-/*200*/ char       ldd_userdata[1024 - 200]; /* arbitrary user string */
-/*1024*/__u8       ldd_padding[4096 - 1024];
-/*4096*/char       ldd_mount_opts[4096]; /* target fs mount opts */
-/*8192*/char       ldd_params[4096];     /* key=value pairs */
-};
-
-
-#define MT_STR(data)    mt_str((data)->ldd_mount_type)
-
-/* Make the mdt/ost server obd name based on the filesystem name */
-static inline int server_make_name(__u32 flags, __u16 index, char *fs,
-				   char *name)
-{
-	if (flags & (LDD_F_SV_TYPE_MDT | LDD_F_SV_TYPE_OST)) {
-		if (!(flags & LDD_F_SV_ALL))
-			sprintf(name, "%.8s%c%s%04x", fs,
-				(flags & LDD_F_VIRGIN) ? ':' :
-					((flags & LDD_F_WRITECONF) ? '=' : '-'),
-				(flags & LDD_F_SV_TYPE_MDT) ? "MDT" : "OST",
-				index);
-	} else if (flags & LDD_F_SV_TYPE_MGS) {
-		sprintf(name, "MGS");
-	} else {
-		CERROR("unknown server type %#x\n", flags);
-		return 1;
-	}
-	return 0;
-}
 
 /****************** mount command *********************/
 
diff --git a/drivers/staging/lustre/lustre/obdclass/llog_internal.h b/drivers/staging/lustre/lustre/obdclass/llog_internal.h
index 5332131..c99e658 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_internal.h
+++ b/drivers/staging/lustre/lustre/obdclass/llog_internal.h
@@ -71,14 +71,6 @@ static inline struct llog_thread_info *llog_info(const struct lu_env *env)
 	return lgi;
 }
 
-static inline void
-lustre_build_llog_lvfs_oid(struct llog_logid *logid, __u64 ino, __u32 gen)
-{
-	ostid_set_seq_llog(&logid->lgl_oi);
-	ostid_set_id(&logid->lgl_oi, ino);
-	logid->lgl_ogen = gen;
-}
-
 int llog_info_init(void);
 void llog_info_fini(void);
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 17/19] staging/lustre: Remove IS_SERVER and all users
  2015-09-16  0:30 ` [PATCH 17/19] staging/lustre: Remove IS_SERVER and all users green
@ 2015-09-16  5:35   ` Sudip Mukherjee
  2015-09-16 15:08     ` Oleg Drokin
  0 siblings, 1 reply; 22+ messages in thread
From: Sudip Mukherjee @ 2015-09-16  5:35 UTC (permalink / raw)
  To: green
  Cc: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin,
	Linux Kernel Mailing List

On Tue, Sep 15, 2015 at 08:30:41PM -0400, green@linuxhacker.ru wrote:
> From: Oleg Drokin <green@linuxhacker.ru>
> 
> Since the client can never be server, this is all dead code.
> 
> Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
> ---
OOPS.. build fails with error:
error: ‘lsi’ undeclared (first use in this function)

reegards
sudip

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 17/19] staging/lustre: Remove IS_SERVER and all users
  2015-09-16  5:35   ` Sudip Mukherjee
@ 2015-09-16 15:08     ` Oleg Drokin
  0 siblings, 0 replies; 22+ messages in thread
From: Oleg Drokin @ 2015-09-16 15:08 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Greg Kroah-Hartman, devel, Andreas Dilger, Linux Kernel Mailing List


On Sep 16, 2015, at 1:35 AM, Sudip Mukherjee wrote:

> On Tue, Sep 15, 2015 at 08:30:41PM -0400, green@linuxhacker.ru wrote:
>> From: Oleg Drokin <green@linuxhacker.ru>
>> 
>> Since the client can never be server, this is all dead code.
>> 
>> Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
>> ---
> OOPS.. build fails with error:
> error: ‘lsi’ undeclared (first use in this function)

Ah, you are right.
Fused the fix in the frong commit. :(

Thanks, I'll resend.

Bye,
    Oleg

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2015-09-16 15:08 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
2015-09-16  0:30 ` [PATCH 01/19] staging/lustre: Remove OBD_CPT_ALLOC_LARGE green
2015-09-16  0:30 ` [PATCH 02/19] staging/lustre: Remove unused OBD_VMALLOC green
2015-09-16  0:30 ` [PATCH 03/19] staging/lustre: Remove unused OBD_CPT_ALLOC* macros green
2015-09-16  0:30 ` [PATCH 04/19] staging/lustre: Remove users of OBD_ALLOC/FREE_PTR lu_object.h green
2015-09-16  0:30 ` [PATCH 05/19] staging/lustre/llite: Get rid of OBD_ALLOC/FREE_PTR green
2015-09-16  0:30 ` [PATCH 06/19] staging/lustre/obdclass: replace OBD_ALLOC_GFP with kzalloc green
2015-09-16  0:30 ` [PATCH 07/19] staging/lustre: Remove references to OBD_ALLOC/FREE* in comments green
2015-09-16  0:30 ` [PATCH 08/19] staging/lustre/fld: Replace OBD_ALLOC_GFP with kzalloc green
2015-09-16  0:30 ` [PATCH 09/19] staging/lustre: Convert lustre_cfg_new/free to use kzalloc/kfree green
2015-09-16  0:30 ` [PATCH 10/19] staging/lustre/ptlrpc: Replace OBD_FREE_PTR with kfree green
2015-09-16  0:30 ` [PATCH 11/19] staging/lustre: Replace last users of OBD_ALLOC/FREE_LARGE green
2015-09-16  0:30 ` [PATCH 12/19] staging/lustre: Remove stray bit of userland utils code green
2015-09-16  0:30 ` [PATCH 13/19] staging/lustre: Remove unused OBD_ALLOC* and OBD_FREE macros green
2015-09-16  0:30 ` [PATCH 14/19] staging/lustre: Remove memory allocation fault injection framework green
2015-09-16  0:30 ` [PATCH 15/19] staging/lustre: Remove lustre used memory tracking framework green
2015-09-16  0:30 ` [PATCH 16/19] staging/lustre: remove obd_memory stats counter green
2015-09-16  0:30 ` [PATCH 17/19] staging/lustre: Remove IS_SERVER and all users green
2015-09-16  5:35   ` Sudip Mukherjee
2015-09-16 15:08     ` Oleg Drokin
2015-09-16  0:30 ` [PATCH 18/19] staging/lustre: remove IS_MDS|IS_OST|IS_MGS defines and users green
2015-09-16  0:30 ` [PATCH 19/19] staging/lustre: Remove server defines from lustre_disk.h green

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).