linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: lustre: obd_support: Add obd_cpt_alloc function
@ 2015-05-02 21:16 Julia Lawall
  2015-05-02 21:38 ` Drokin, Oleg
  2015-05-02 21:47 ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2015-05-02 21:16 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: kernel-janitors, Andreas Dilger, Greg Kroah-Hartman, HPDD-discuss,
	devel, linux-kernel

Summarize OBD_CPT_ALLOC_GFP, OBD_CPT_ALLOC, and OBD_CPT_ALLOC_PTR as a
function, obd_cpt_alloc.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---

Some questions: Is the name OK?  Is the NULL test needed?  If not, should
the call to kzalloc_node with the call to cfs_cpt_spread_node just be
inlined into the call sites?

 drivers/staging/lustre/lustre/include/obd_support.h |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 2991d2e..3d380f0 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -655,6 +655,15 @@ do {									      \
 #define OBD_CPT_ALLOC_PTR(ptr, cptab, cpt)				      \
 	OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
 
+static inline void *obd_cpt_alloc(struct cfs_cpt_table *cptab, int cpt,
+				  size_t size, gfp_t flags)
+{
+	return (cptab) == NULL ?
+		kzalloc(size, flags) :
+		kzalloc_node(size, flags, cfs_cpt_spread_node(cptab, cpt));
+}
+
+
 # define __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size)			      \
 do {									      \
 	(ptr) = cptab == NULL ?						      \


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

end of thread, other threads:[~2015-05-03 10:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-02 21:16 [PATCH] staging: lustre: obd_support: Add obd_cpt_alloc function Julia Lawall
2015-05-02 21:38 ` Drokin, Oleg
2015-05-03  5:53   ` Julia Lawall
2015-05-03 10:29     ` Drokin, Oleg
2015-05-02 21:47 ` Dan Carpenter

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).