Whamcloud - gitweb
LU-5304: use kzalloc/vzalloc instead of [kv]malloc+memset
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-mem.c
index cc18de2..8cdf07d 100644 (file)
@@ -45,23 +45,17 @@ void *
 cfs_cpt_malloc(struct cfs_cpt_table *cptab, int cpt,
               size_t nr_bytes, unsigned int flags)
 {
-       void    *ptr;
-
-       ptr = kmalloc_node(nr_bytes, flags,
-                          cfs_cpt_spread_node(cptab, cpt));
-       if (ptr != NULL && (flags & __GFP_ZERO) != 0)
-               memset(ptr, 0, nr_bytes);
-
-       return ptr;
+       return kmalloc_node(nr_bytes, flags,
+                           cfs_cpt_spread_node(cptab, cpt));
 }
 EXPORT_SYMBOL(cfs_cpt_malloc);
 
 void *
-cfs_cpt_vmalloc(struct cfs_cpt_table *cptab, int cpt, size_t nr_bytes)
+cfs_cpt_vzalloc(struct cfs_cpt_table *cptab, int cpt, size_t nr_bytes)
 {
-       return vmalloc_node(nr_bytes, cfs_cpt_spread_node(cptab, cpt));
+       return vzalloc_node(nr_bytes, cfs_cpt_spread_node(cptab, cpt));
 }
-EXPORT_SYMBOL(cfs_cpt_vmalloc);
+EXPORT_SYMBOL(cfs_cpt_vzalloc);
 
 struct page *
 cfs_page_cpt_alloc(struct cfs_cpt_table *cptab, int cpt, unsigned int flags)