Commit 3dd84289 authored by Amitoj Kaur Chawla's avatar Amitoj Kaur Chawla Committed by Greg Kroah-Hartman

staging: lustre: lclient: Replace kmem_cache_alloc with kmem_cache_zalloc

Use kmem_cache_zalloc instead of manually setting kmem_cache_alloc
with flag GFP_ZERO since kmem_alloc_zalloc sets allocated memory
to zero.

The Coccinelle semantic patch used to make this change is as
follows:
// <smpl>
@@
expression e,f;
@@
- kmem_cache_alloc(e, f |__GFP_ZERO)
+ kmem_cache_zalloc(e, f)
// </smpl>
Signed-off-by: default avatarAmitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a9eddde6
...@@ -116,7 +116,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key) ...@@ -116,7 +116,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key)
{ {
struct ccc_thread_info *info; struct ccc_thread_info *info;
info = kmem_cache_alloc(ccc_thread_kmem, GFP_NOFS | __GFP_ZERO); info = kmem_cache_zalloc(ccc_thread_kmem, GFP_NOFS);
if (!info) if (!info)
info = ERR_PTR(-ENOMEM); info = ERR_PTR(-ENOMEM);
return info; return info;
...@@ -135,7 +135,7 @@ void *ccc_session_key_init(const struct lu_context *ctx, ...@@ -135,7 +135,7 @@ void *ccc_session_key_init(const struct lu_context *ctx,
{ {
struct ccc_session *session; struct ccc_session *session;
session = kmem_cache_alloc(ccc_session_kmem, GFP_NOFS | __GFP_ZERO); session = kmem_cache_zalloc(ccc_session_kmem, GFP_NOFS);
if (!session) if (!session)
session = ERR_PTR(-ENOMEM); session = ERR_PTR(-ENOMEM);
return session; return session;
...@@ -251,7 +251,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev, ...@@ -251,7 +251,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev,
struct ccc_req *vrq; struct ccc_req *vrq;
int result; int result;
vrq = kmem_cache_alloc(ccc_req_kmem, GFP_NOFS | __GFP_ZERO); vrq = kmem_cache_zalloc(ccc_req_kmem, GFP_NOFS);
if (vrq) { if (vrq) {
cl_req_slice_add(req, &vrq->crq_cl, dev, &ccc_req_ops); cl_req_slice_add(req, &vrq->crq_cl, dev, &ccc_req_ops);
result = 0; result = 0;
...@@ -327,7 +327,7 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env, ...@@ -327,7 +327,7 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env,
struct ccc_object *vob; struct ccc_object *vob;
struct lu_object *obj; struct lu_object *obj;
vob = kmem_cache_alloc(ccc_object_kmem, GFP_NOFS | __GFP_ZERO); vob = kmem_cache_zalloc(ccc_object_kmem, GFP_NOFS);
if (vob) { if (vob) {
struct cl_object_header *hdr; struct cl_object_header *hdr;
...@@ -396,7 +396,7 @@ int ccc_lock_init(const struct lu_env *env, ...@@ -396,7 +396,7 @@ int ccc_lock_init(const struct lu_env *env,
CLOBINVRNT(env, obj, ccc_object_invariant(obj)); CLOBINVRNT(env, obj, ccc_object_invariant(obj));
clk = kmem_cache_alloc(ccc_lock_kmem, GFP_NOFS | __GFP_ZERO); clk = kmem_cache_zalloc(ccc_lock_kmem, GFP_NOFS);
if (clk) { if (clk) {
cl_lock_slice_add(lock, &clk->clk_cl, obj, lkops); cl_lock_slice_add(lock, &clk->clk_cl, obj, lkops);
result = 0; result = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment