From c4418daca7a27474eda4a926f0645054516c7d7f Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Fri, 26 Feb 2016 14:24:55 +0530 Subject: [PATCH] staging: lustre: osc: 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: // @@ expression e,f; @@ - kmem_cache_alloc(e, f |__GFP_ZERO) + kmem_cache_zalloc(e, f) // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_cache.c | 2 +- drivers/staging/lustre/lustre/osc/osc_dev.c | 4 ++-- drivers/staging/lustre/lustre/osc/osc_io.c | 2 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 2 +- drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- drivers/staging/lustre/lustre/osc/osc_quota.c | 2 +- drivers/staging/lustre/lustre/osc/osc_request.c | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 031746a2b9ba..6243aac9b9f1 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -347,7 +347,7 @@ static struct osc_extent *osc_extent_alloc(struct osc_object *obj) { struct osc_extent *ext; - ext = kmem_cache_alloc(osc_extent_kmem, GFP_NOFS | __GFP_ZERO); + ext = kmem_cache_zalloc(osc_extent_kmem, GFP_NOFS); if (!ext) return NULL; diff --git a/drivers/staging/lustre/lustre/osc/osc_dev.c b/drivers/staging/lustre/lustre/osc/osc_dev.c index 67cb6e4254f7..d4fe507f165f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_dev.c +++ b/drivers/staging/lustre/lustre/osc/osc_dev.c @@ -122,7 +122,7 @@ static void *osc_key_init(const struct lu_context *ctx, { struct osc_thread_info *info; - info = kmem_cache_alloc(osc_thread_kmem, GFP_NOFS | __GFP_ZERO); + info = kmem_cache_zalloc(osc_thread_kmem, GFP_NOFS); if (!info) info = ERR_PTR(-ENOMEM); return info; @@ -147,7 +147,7 @@ static void *osc_session_init(const struct lu_context *ctx, { struct osc_session *info; - info = kmem_cache_alloc(osc_session_kmem, GFP_NOFS | __GFP_ZERO); + info = kmem_cache_zalloc(osc_session_kmem, GFP_NOFS); if (!info) info = ERR_PTR(-ENOMEM); return info; diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index add94a25d36b..6bd0a45d8b06 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -803,7 +803,7 @@ int osc_req_init(const struct lu_env *env, struct cl_device *dev, struct osc_req *or; int result; - or = kmem_cache_alloc(osc_req_kmem, GFP_NOFS | __GFP_ZERO); + or = kmem_cache_zalloc(osc_req_kmem, GFP_NOFS); if (or) { cl_req_slice_add(req, &or->or_cl, dev, &osc_req_ops); result = 0; diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 6fcdf91dac59..8a3e872c94e0 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -1567,7 +1567,7 @@ int osc_lock_init(const struct lu_env *env, struct osc_lock *clk; int result; - clk = kmem_cache_alloc(osc_lock_kmem, GFP_NOFS | __GFP_ZERO); + clk = kmem_cache_zalloc(osc_lock_kmem, GFP_NOFS); if (clk) { __u32 enqflags = lock->cll_descr.cld_enq_flags; diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c index 60d8230e3a4b..9d474fcdd9a7 100644 --- a/drivers/staging/lustre/lustre/osc/osc_object.c +++ b/drivers/staging/lustre/lustre/osc/osc_object.c @@ -255,7 +255,7 @@ struct lu_object *osc_object_alloc(const struct lu_env *env, struct osc_object *osc; struct lu_object *obj; - osc = kmem_cache_alloc(osc_object_kmem, GFP_NOFS | __GFP_ZERO); + osc = kmem_cache_zalloc(osc_object_kmem, GFP_NOFS); if (osc) { obj = osc2lu(osc); lu_object_init(obj, NULL, dev); diff --git a/drivers/staging/lustre/lustre/osc/osc_quota.c b/drivers/staging/lustre/lustre/osc/osc_quota.c index 208f72b5dc66..194d8ede40a2 100644 --- a/drivers/staging/lustre/lustre/osc/osc_quota.c +++ b/drivers/staging/lustre/lustre/osc/osc_quota.c @@ -30,7 +30,7 @@ static inline struct osc_quota_info *osc_oqi_alloc(u32 id) { struct osc_quota_info *oqi; - oqi = kmem_cache_alloc(osc_quota_kmem, GFP_NOFS | __GFP_ZERO); + oqi = kmem_cache_zalloc(osc_quota_kmem, GFP_NOFS); if (oqi) oqi->oqi_id = id; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 770d6fc2aaee..2238f92ce644 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1896,7 +1896,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, goto out; } - oa = kmem_cache_alloc(obdo_cachep, GFP_NOFS | __GFP_ZERO); + oa = kmem_cache_zalloc(obdo_cachep, GFP_NOFS); if (!oa) { rc = -ENOMEM; goto out; @@ -2958,7 +2958,7 @@ static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp, CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args)); aa = ptlrpc_req_async_args(req); - oa = kmem_cache_alloc(obdo_cachep, GFP_NOFS | __GFP_ZERO); + oa = kmem_cache_zalloc(obdo_cachep, GFP_NOFS); if (!oa) { ptlrpc_req_finished(req); return -ENOMEM; -- 2.34.1