summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>2016-02-26 08:54:55 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-02 03:18:42 (GMT)
commitc4418daca7a27474eda4a926f0645054516c7d7f (patch)
treecb062c45ada780fc4b00d52fe3167597da71b660
parent1c147c83f3d663751d849cb97b5aba409f5867cb (diff)
downloadlinux-c4418daca7a27474eda4a926f0645054516c7d7f.tar.xz
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: // <smpl> @@ expression e,f; @@ - kmem_cache_alloc(e, f |__GFP_ZERO) + kmem_cache_zalloc(e, f) // </smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_cache.c2
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_dev.c4
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_io.c2
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_lock.c2
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_object.c2
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_quota.c2
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_request.c4
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 031746a..6243aac 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 67cb6e4..d4fe507 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 add94a2..6bd0a45 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 6fcdf91..8a3e872c 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 60d8230..9d474fc 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 208f72b..194d8ed 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 770d6fc..2238f92 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;