staging: lustre: Replace kmem_cache_alloc with kmem_cache_zalloc
cover staging: lustre: Replace kmem_cache_alloc with kmem_cache_zalloc
This patchset replaces kmem_cache_alloc with kmem_cache_zalloc.
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>
Amitoj Kaur Chawla (8):
staging: lustre: lclient: Replace kmem_cache_alloc with
kmem_cache_zalloc
staging: lustre: obdclass: Replace kmem_cache_alloc with
kmem_cache_zalloc
staging: lustre: lov: Replace kmem_cache_alloc with kmem_cache_zalloc
staging: lustre: obdecho: Replace kmem_cache_alloc with
kmem_cache_zalloc
staging: lustre: ptlrpc: Replace kmem_cache_alloc with
kmem_cache_zalloc
staging: lustre: osc: Replace kmem_cache_alloc with kmem_cache_zalloc
staging: lustre: ldlm: Replace kmem_cache_alloc with kmem_cache_zalloc
staging: lustre: llite: Replace kmem_cache_alloc with
kmem_cache_zalloc
drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 10 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 4 ++-- drivers/staging/lustre/lustre/llite/llite_close.c | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 +-- drivers/staging/lustre/lustre/llite/namei.c | 2 +- drivers/staging/lustre/lustre/llite/remote_perm.c | 4 ++-- drivers/staging/lustre/lustre/llite/super25.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 4 ++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 +- drivers/staging/lustre/lustre/lov/lov_dev.c | 6 +++--- drivers/staging/lustre/lustre/lov/lov_ea.c | 2 +- drivers/staging/lustre/lustre/lov/lov_lock.c | 6 +++--- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/lov/lov_request.c | 11 ++++------- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- drivers/staging/lustre/lustre/obdecho/echo_client.c | 8 ++++---- 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 ++-- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- 32 files changed, 51 insertions(+), 55 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/8 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>
--- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +5 -5
@@ -116,7 +116,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key) {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) info =ERR_PTR (-ENOMEM );return info;
@@ -135,7 +135,7 @@ void *ccc_session_key_init(const struct lu_context *ctx, {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) session =ERR_PTR (-ENOMEM );return session;
@@ -251,7 +251,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev,struct ccc_req *vrq;int result; - vrq =kmem_cache_alloc (ccc_req_kmem,GFP_NOFS | __GFP_ZERO); + vrq =kmem_cache_zalloc (ccc_req_kmem,GFP_NOFS );if (vrq) {cl_req_slice_add (req, &vrq->crq_cl, dev, &ccc_req_ops); result =0 ;
@@ -327,7 +327,7 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env,struct ccc_object *vob;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) {struct cl_object_header *hdr;
@@ -396,7 +396,7 @@ int ccc_lock_init(const struct lu_env *env,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) {cl_lock_slice_add (lock, &clk->clk_cl, obj, lkops); result =0 ;
Signature · 1 line
1.9.1
PATCH 2/8 staging: lustre: obdclass: Replace kmem_cache_alloc with kmem_cache_zalloc
In reply to Amitoj Kaur ChawlaUse 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>
--- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/obdclass/cl_lock.c +1 -1
@@ -361,7 +361,7 @@ static struct cl_lock *cl_lock_alloc(const struct lu_env *env,struct cl_lock *lock;struct lu_object_header *head; - lock =kmem_cache_alloc (cl_lock_kmem,GFP_NOFS | __GFP_ZERO); + lock =kmem_cache_zalloc (cl_lock_kmem,GFP_NOFS );if (lock) {atomic_set (&lock->cll_ref,1 ); lock->cll_descr = *descr;
drivers/staging/lustre/lustre/obdclass/cl_object.c +1 -1
@@ -662,7 +662,7 @@ static struct lu_env *cl_env_new(__u32 ctx_tags, __u32 ses_tags, void *debug)struct lu_env *env;struct cl_env *cle; - cle =kmem_cache_alloc (cl_env_kmem,GFP_NOFS | __GFP_ZERO); + cle =kmem_cache_zalloc (cl_env_kmem,GFP_NOFS );if (cle) {int rc;
drivers/staging/lustre/lustre/obdclass/genops.c +1 -1
@@ -69,7 +69,7 @@ static struct obd_device *obd_device_alloc(void) {struct obd_device *obd; - obd =kmem_cache_alloc (obd_device_cachep,GFP_NOFS | __GFP_ZERO); + obd =kmem_cache_zalloc (obd_device_cachep,GFP_NOFS );if (obd) obd->obd_magic =OBD_DEVICE_MAGIC ;return obd;
Signature · 1 line
1.9.1
PATCH 3/8 staging: lustre: lov: Replace kmem_cache_alloc with kmem_cache_zalloc
In reply to Amitoj Kaur ChawlaUse 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>
--- drivers/staging/lustre/lustre/lov/lov_dev.c | 6 +++--- drivers/staging/lustre/lustre/lov/lov_ea.c | 2 +- drivers/staging/lustre/lustre/lov/lov_lock.c | 6 +++--- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/lov/lov_request.c | 11 ++++------- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 2 +- 8 files changed, 15 insertions(+), 18 deletions(-)
drivers/staging/lustre/lustre/lov/lov_dev.c +3 -3
@@ -142,7 +142,7 @@ static void *lov_key_init(const struct lu_context *ctx, {struct lov_thread_info *info; - info =kmem_cache_alloc (lov_thread_kmem,GFP_NOFS | __GFP_ZERO); + info =kmem_cache_zalloc (lov_thread_kmem,GFP_NOFS );if (info)INIT_LIST_HEAD (&info->lti_closure.clc_list);else
@@ -170,7 +170,7 @@ static void *lov_session_key_init(const struct lu_context *ctx, {struct lov_session *info; - info =kmem_cache_alloc (lov_session_kmem,GFP_NOFS | __GFP_ZERO); + info =kmem_cache_zalloc (lov_session_kmem,GFP_NOFS );if (!info) info =ERR_PTR (-ENOMEM );return info;
@@ -261,7 +261,7 @@ static int lov_req_init(const struct lu_env *env, struct cl_device *dev,struct lov_req *lr;int result; - lr =kmem_cache_alloc (lov_req_kmem,GFP_NOFS | __GFP_ZERO); + lr =kmem_cache_zalloc (lov_req_kmem,GFP_NOFS );if (lr) {cl_req_slice_add (req, &lr->lr_cl, dev, &lov_req_ops); result =0 ;
drivers/staging/lustre/lustre/lov/lov_ea.c +1 -1
@@ -100,7 +100,7 @@ struct lov_stripe_md *lsm_alloc_plain(__u16 stripe_count, int *size)return NULL ;for (i =0 ; i < stripe_count; i++) { - loi =kmem_cache_alloc (lov_oinfo_slab,GFP_NOFS | __GFP_ZERO); + loi =kmem_cache_zalloc (lov_oinfo_slab,GFP_NOFS );if (!loi) goto err; lsm->lsm_oinfo[i] = loi;
drivers/staging/lustre/lustre/lov/lov_lock.c +3 -3
@@ -144,7 +144,7 @@ static struct cl_lock *lov_sublock_alloc(const struct lu_env *env,LASSERT (idx < lck->lls_nr); - link =kmem_cache_alloc (lov_lock_link_kmem,GFP_NOFS | __GFP_ZERO); + link =kmem_cache_zalloc (lov_lock_link_kmem,GFP_NOFS );if (link) {struct lov_sublock_env *subenv;struct lov_lock_sub *lls;
@@ -1107,7 +1107,7 @@ int lov_lock_init_raid0(const struct lu_env *env, struct cl_object *obj,struct lov_lock *lck;int result; - lck =kmem_cache_alloc (lov_lock_kmem,GFP_NOFS | __GFP_ZERO); + lck =kmem_cache_zalloc (lov_lock_kmem,GFP_NOFS );if (lck) {cl_lock_slice_add (lock, &lck->lls_cl, obj, &lov_lock_ops); result =lov_lock_sub_init (env, lck, io);
@@ -1143,7 +1143,7 @@ int lov_lock_init_empty(const struct lu_env *env, struct cl_object *obj,struct lov_lock *lck;int result = -ENOMEM ; - lck =kmem_cache_alloc (lov_lock_kmem,GFP_NOFS | __GFP_ZERO); + lck =kmem_cache_zalloc (lov_lock_kmem,GFP_NOFS );if (lck) {cl_lock_slice_add (lock, &lck->lls_cl, obj, &lov_empty_lock_ops); lck->lls_orig = lock->cll_descr;
drivers/staging/lustre/lustre/lov/lov_object.c +1 -1
@@ -899,7 +899,7 @@ struct lu_object *lov_object_alloc(const struct lu_env *env,struct lov_object *lov;struct lu_object *obj; - lov =kmem_cache_alloc (lov_object_kmem,GFP_NOFS | __GFP_ZERO); + lov =kmem_cache_zalloc (lov_object_kmem,GFP_NOFS );if (lov) { obj =lov2lu (lov);lu_object_init (obj,NULL , dev);
drivers/staging/lustre/lustre/lov/lov_request.c +4 -7
@@ -200,7 +200,7 @@ static int common_attr_done(struct lov_request_set *set)if (!atomic_read (&set->set_success))return -EIO ; - tmp_oa =kmem_cache_alloc (obdo_cachep,GFP_NOFS | __GFP_ZERO); + tmp_oa =kmem_cache_zalloc (obdo_cachep,GFP_NOFS );if (!tmp_oa) { rc = -ENOMEM ; goto out;
@@ -307,8 +307,7 @@ int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_stripe = i; req->rq_idx = loi->loi_ost_idx; - req->rq_oi.oi_oa =kmem_cache_alloc (obdo_cachep, -GFP_NOFS | __GFP_ZERO); + req->rq_oi.oi_oa =kmem_cache_zalloc (obdo_cachep,GFP_NOFS );if (!req->rq_oi.oi_oa) {kfree (req); rc = -ENOMEM ;
@@ -390,8 +389,7 @@ int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_stripe = i; req->rq_idx = loi->loi_ost_idx; - req->rq_oi.oi_oa =kmem_cache_alloc (obdo_cachep, -GFP_NOFS | __GFP_ZERO); + req->rq_oi.oi_oa =kmem_cache_zalloc (obdo_cachep,GFP_NOFS );if (!req->rq_oi.oi_oa) {kfree (req); rc = -ENOMEM ;
@@ -507,8 +505,7 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_stripe = i; req->rq_idx = loi->loi_ost_idx; - req->rq_oi.oi_oa =kmem_cache_alloc (obdo_cachep, -GFP_NOFS | __GFP_ZERO); + req->rq_oi.oi_oa =kmem_cache_zalloc (obdo_cachep,GFP_NOFS );if (!req->rq_oi.oi_oa) {kfree (req); rc = -ENOMEM ;
drivers/staging/lustre/lustre/lov/lovsub_dev.c +1 -1
@@ -147,7 +147,7 @@ static int lovsub_req_init(const struct lu_env *env, struct cl_device *dev,struct lovsub_req *lsr;int result; - lsr =kmem_cache_alloc (lovsub_req_kmem,GFP_NOFS | __GFP_ZERO); + lsr =kmem_cache_zalloc (lovsub_req_kmem,GFP_NOFS );if (lsr) {cl_req_slice_add (req, &lsr->lsrq_cl, dev, &lovsub_req_ops); result =0 ;
drivers/staging/lustre/lustre/lov/lovsub_lock.c +1 -1
@@ -455,7 +455,7 @@ int lovsub_lock_init(const struct lu_env *env, struct cl_object *obj,struct lovsub_lock *lsk;int result; - lsk =kmem_cache_alloc (lovsub_lock_kmem,GFP_NOFS | __GFP_ZERO); + lsk =kmem_cache_zalloc (lovsub_lock_kmem,GFP_NOFS );if (lsk) {INIT_LIST_HEAD (&lsk->lss_parents);cl_lock_slice_add (lock, &lsk->lss_cl, obj, &lovsub_lock_ops);
drivers/staging/lustre/lustre/lov/lovsub_object.c +1 -1
@@ -143,7 +143,7 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env,struct lovsub_object *los;struct lu_object *obj; - los =kmem_cache_alloc (lovsub_object_kmem,GFP_NOFS | __GFP_ZERO); + los =kmem_cache_zalloc (lovsub_object_kmem,GFP_NOFS );if (los) {struct cl_object_header *hdr;
Signature · 1 line
1.9.1
PATCH 4/8 staging: lustre: obdecho: Replace kmem_cache_alloc with kmem_cache_zalloc
In reply to Amitoj Kaur ChawlaUse 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>
--- drivers/staging/lustre/lustre/obdecho/echo_client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/obdecho/echo_client.c +4 -4
@@ -392,7 +392,7 @@ static int echo_lock_init(const struct lu_env *env, {struct echo_lock *el; - el =kmem_cache_alloc (echo_lock_kmem,GFP_NOFS | __GFP_ZERO); + el =kmem_cache_zalloc (echo_lock_kmem,GFP_NOFS );if (el) {cl_lock_slice_add (lock, &el->el_cl, obj, &echo_lock_ops); el->el_object =cl2echo_obj (obj);
@@ -562,7 +562,7 @@ static struct lu_object *echo_object_alloc(const struct lu_env *env,/* we're the top dev. */ LASSERT (!hdr); - eco =kmem_cache_alloc (echo_object_kmem,GFP_NOFS | __GFP_ZERO); + eco =kmem_cache_zalloc (echo_object_kmem,GFP_NOFS );if (eco) {struct cl_object_header *hdr = &eco->eo_hdr;
@@ -625,7 +625,7 @@ static void *echo_thread_key_init(const struct lu_context *ctx, {struct echo_thread_info *info; - info =kmem_cache_alloc (echo_thread_kmem,GFP_NOFS | __GFP_ZERO); + info =kmem_cache_zalloc (echo_thread_kmem,GFP_NOFS );if (!info) info =ERR_PTR (-ENOMEM );return info;
@@ -656,7 +656,7 @@ static void *echo_session_key_init(const struct lu_context *ctx, {struct echo_session_info *session; - session =kmem_cache_alloc (echo_session_kmem,GFP_NOFS | __GFP_ZERO); + session =kmem_cache_zalloc (echo_session_kmem,GFP_NOFS );if (!session) session =ERR_PTR (-ENOMEM );return session;
Signature · 1 line
1.9.1
PATCH 5/8 staging: lustre: ptlrpc: Replace kmem_cache_alloc with kmem_cache_zalloc
In reply to Amitoj Kaur ChawlaUse 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>
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +1 -1
@@ -423,7 +423,7 @@ struct ptlrpc_request *ptlrpc_request_cache_alloc(gfp_t flags) {struct ptlrpc_request *req; - req =kmem_cache_alloc (request_cache, flags | __GFP_ZERO); + req =kmem_cache_zalloc (request_cache, flags);return req; }
Signature · 1 line
1.9.1
PATCH 6/8 staging: lustre: osc: Replace kmem_cache_alloc with kmem_cache_zalloc
In reply to Amitoj Kaur ChawlaUse 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>
--- 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(-)
drivers/staging/lustre/lustre/osc/osc_cache.c +1 -1
@@ -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 ;
drivers/staging/lustre/lustre/osc/osc_dev.c +2 -2
@@ -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;
drivers/staging/lustre/lustre/osc/osc_io.c +1 -1
@@ -804,7 +804,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 ;
drivers/staging/lustre/lustre/osc/osc_lock.c +1 -1
@@ -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;
drivers/staging/lustre/lustre/osc/osc_object.c +1 -1
@@ -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);
drivers/staging/lustre/lustre/osc/osc_quota.c +1 -1
@@ -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;
drivers/staging/lustre/lustre/osc/osc_request.c +2 -2
@@ -1897,7 +1897,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;
@@ -2959,7 +2959,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 ;
Signature · 1 line
1.9.1
PATCH 7/8 staging: lustre: ldlm: Replace kmem_cache_alloc with kmem_cache_zalloc
In reply to Amitoj Kaur ChawlaUse 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>
--- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +1 -1
@@ -115,7 +115,7 @@ struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock)struct ldlm_interval *node;LASSERT (lock->l_resource->lr_type ==LDLM_EXTENT ); - node =kmem_cache_alloc (ldlm_interval_slab,GFP_NOFS | __GFP_ZERO); + node =kmem_cache_zalloc (ldlm_interval_slab,GFP_NOFS );if (!node)return NULL ;
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +1 -1
@@ -406,7 +406,7 @@ static struct ldlm_lock *ldlm_lock_new(struct ldlm_resource *resource)LASSERT (resource); - lock =kmem_cache_alloc (ldlm_lock_slab,GFP_NOFS | __GFP_ZERO); + lock =kmem_cache_zalloc (ldlm_lock_slab,GFP_NOFS );if (!lock)return NULL ;
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +1 -1
@@ -1041,7 +1041,7 @@ static struct ldlm_resource *ldlm_resource_new(void)struct ldlm_resource *res;int idx; - res =kmem_cache_alloc (ldlm_resource_slab,GFP_NOFS | __GFP_ZERO); + res =kmem_cache_zalloc (ldlm_resource_slab,GFP_NOFS );if (!res)return NULL ;
Signature · 1 line
1.9.1
PATCH 8/8 staging: lustre: llite: Replace kmem_cache_alloc with kmem_cache_zalloc
In reply to Amitoj Kaur ChawlaUse 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>
--- drivers/staging/lustre/lustre/llite/file.c | 4 ++-- drivers/staging/lustre/lustre/llite/llite_close.c | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 +-- drivers/staging/lustre/lustre/llite/namei.c | 2 +- drivers/staging/lustre/lustre/llite/remote_perm.c | 4 ++-- drivers/staging/lustre/lustre/llite/super25.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 4 ++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 +- 8 files changed, 11 insertions(+), 12 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +2 -2
@@ -64,7 +64,7 @@ static struct ll_file_data *ll_file_data_get(void) {struct ll_file_data *fd; - fd =kmem_cache_alloc (ll_file_data_slab,GFP_NOFS | __GFP_ZERO); + fd =kmem_cache_zalloc (ll_file_data_slab,GFP_NOFS );if (!fd)return NULL ; fd->fd_write_failed = false;
@@ -1278,7 +1278,7 @@ static int ll_lov_recreate(struct inode *inode, struct ost_id *oi, u32 ost_idx)int rc =0 ;struct lov_stripe_md *lsm =NULL , *lsm2; - oa =kmem_cache_alloc (obdo_cachep,GFP_NOFS | __GFP_ZERO); + oa =kmem_cache_zalloc (obdo_cachep,GFP_NOFS );if (!oa)return -ENOMEM ;
drivers/staging/lustre/lustre/llite/llite_close.c +1 -1
@@ -226,7 +226,7 @@ int ll_som_update(struct inode *inode, struct md_op_data *op_data) inode->i_ino, inode->i_generation, lli->lli_flags); - oa =kmem_cache_alloc (obdo_cachep,GFP_NOFS | __GFP_ZERO); + oa =kmem_cache_zalloc (obdo_cachep,GFP_NOFS );if (!oa) {CERROR ("can't allocate memory for Size-on-MDS update.\n" );return -ENOMEM ;
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -2
@@ -1793,8 +1793,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,return 0 ; } - oinfo.oi_oa =kmem_cache_alloc (obdo_cachep, -GFP_NOFS | __GFP_ZERO); + oinfo.oi_oa =kmem_cache_zalloc (obdo_cachep,GFP_NOFS );if (!oinfo.oi_oa) {ccc_inode_lsm_put (inode, lsm);return -ENOMEM ;
drivers/staging/lustre/lustre/llite/namei.c +1 -1
@@ -887,7 +887,7 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) }LASSERT (rc >=sizeof (*lsm)); - oa =kmem_cache_alloc (obdo_cachep,GFP_NOFS | __GFP_ZERO); + oa =kmem_cache_zalloc (obdo_cachep,GFP_NOFS );if (!oa) { rc = -ENOMEM ; goto out_free_memmd;
drivers/staging/lustre/lustre/llite/remote_perm.c +2 -2
@@ -61,7 +61,7 @@ static inline struct ll_remote_perm *alloc_ll_remote_perm(void) {struct ll_remote_perm *lrp; - lrp =kmem_cache_alloc (ll_remote_perm_cachep,GFP_KERNEL | __GFP_ZERO); + lrp =kmem_cache_zalloc (ll_remote_perm_cachep,GFP_KERNEL );if (lrp)INIT_HLIST_NODE (&lrp->lrp_list);return lrp;
@@ -82,7 +82,7 @@ static struct hlist_head *alloc_rmtperm_hash(void)struct hlist_head *hash;int i; - hash =kmem_cache_alloc (ll_rmtperm_hash_cachep,GFP_NOFS | __GFP_ZERO); + hash =kmem_cache_zalloc (ll_rmtperm_hash_cachep,GFP_NOFS );if (!hash)return NULL ;
drivers/staging/lustre/lustre/llite/super25.c +1 -1
@@ -53,7 +53,7 @@ static struct inode *ll_alloc_inode(struct super_block *sb)struct ll_inode_info *lli;ll_stats_ops_tally (ll_s2sbi (sb),LPROC_LL_ALLOC_INODE ,1 ); - lli =kmem_cache_alloc (ll_inode_cachep,GFP_NOFS | __GFP_ZERO); + lli =kmem_cache_zalloc (ll_inode_cachep,GFP_NOFS );if (!lli)return NULL ;
drivers/staging/lustre/lustre/llite/vvp_dev.c +2 -2
@@ -79,7 +79,7 @@ static void *vvp_key_init(const struct lu_context *ctx, {struct vvp_thread_info *info; - info =kmem_cache_alloc (vvp_thread_kmem,GFP_NOFS | __GFP_ZERO); + info =kmem_cache_zalloc (vvp_thread_kmem,GFP_NOFS );if (!info) info =ERR_PTR (-ENOMEM );return info;
@@ -98,7 +98,7 @@ static void *vvp_session_key_init(const struct lu_context *ctx, {struct vvp_session *session; - session =kmem_cache_alloc (vvp_session_kmem,GFP_NOFS | __GFP_ZERO); + session =kmem_cache_zalloc (vvp_session_kmem,GFP_NOFS );if (!session) session =ERR_PTR (-ENOMEM );return session;
drivers/staging/lustre/lustre/llite/xattr_cache.c +1 -1
@@ -114,7 +114,7 @@ static int ll_xattr_cache_add(struct list_head *cache,return -EPROTO ; } - xattr =kmem_cache_alloc (xattr_kmem,GFP_NOFS | __GFP_ZERO); + xattr =kmem_cache_zalloc (xattr_kmem,GFP_NOFS );if (!xattr) {CDEBUG (D_CACHE ,"failed to allocate xattr\n" );return -ENOMEM ;
Signature · 1 line
1.9.1