]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: lustre: osc: Replace kmem_cache_alloc with kmem_cache_zalloc
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Fri, 26 Feb 2016 08:54:55 +0000 (14:24 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Mar 2016 03:18:42 +0000 (19:18 -0800)
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>
drivers/staging/lustre/lustre/osc/osc_cache.c
drivers/staging/lustre/lustre/osc/osc_dev.c
drivers/staging/lustre/lustre/osc/osc_io.c
drivers/staging/lustre/lustre/osc/osc_lock.c
drivers/staging/lustre/lustre/osc/osc_object.c
drivers/staging/lustre/lustre/osc/osc_quota.c
drivers/staging/lustre/lustre/osc/osc_request.c

index 031746a2b9ba589674c1689d230e858d394f9481..6243aac9b9f1b2317e1619c6193797e99cd30cf6 100644 (file)
@@ -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;
 
index 67cb6e4254f790e8814d7ad1069918c916ed8249..d4fe507f165f463a065ce3f808aa12641f34f242 100644 (file)
@@ -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;
index add94a25d36ba201a64ec3fa1bcbbd5a60f95854..6bd0a45d8b0610ad75f0fc8f12e591c0637b6b7a 100644 (file)
@@ -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;
index 6fcdf91dac59e2ca8d353ce168a23ac420238ae2..8a3e872c94e0e77f64db7ea1c5a24992c6273a2e 100644 (file)
@@ -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;
 
index 60d8230e3a4b3828c52e561377de827f6b7ab6a2..9d474fcdd9a74b965f7a7bdd511e0596276ee981 100644 (file)
@@ -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);
index 208f72b5dc66026d3eda6dff13fba2fc3ef5c573..194d8ede40a2f852dd7f9b7556340ea640298d72 100644 (file)
@@ -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;
 
index 770d6fc2aaee4726decf6e91e056820dfa25cc1e..2238f92ce6449126a9a82dacfd2948e2e8f4c8c4 100644 (file)
@@ -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;