staging: lustre: replace OBD_SLAB_FREE_PTR with kmem_cache_free
authorMike Rapoport <mike.rapoport@gmail.com>
Tue, 20 Oct 2015 09:39:51 +0000 (12:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Oct 2015 01:46:17 +0000 (18:46 -0700)
Use kmem_cache_free directly instead of wrapping macro.

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 files changed:
drivers/staging/lustre/lustre/lclient/lcommon_cl.c
drivers/staging/lustre/lustre/llite/file.c
drivers/staging/lustre/lustre/llite/super25.c
drivers/staging/lustre/lustre/llite/vvp_dev.c
drivers/staging/lustre/lustre/llite/xattr_cache.c
drivers/staging/lustre/lustre/lov/lov_dev.c
drivers/staging/lustre/lustre/lov/lov_lock.c
drivers/staging/lustre/lustre/lov/lov_object.c
drivers/staging/lustre/lustre/lov/lovsub_dev.c
drivers/staging/lustre/lustre/lov/lovsub_lock.c
drivers/staging/lustre/lustre/lov/lovsub_object.c
drivers/staging/lustre/lustre/obdclass/cl_lock.c
drivers/staging/lustre/lustre/obdclass/cl_object.c
drivers/staging/lustre/lustre/obdclass/genops.c
drivers/staging/lustre/lustre/obdecho/echo_client.c
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/ptlrpc/client.c

index 7794bfaba4dda9528b34d18ff49658b1c6a5fff8..0b8e4d2175ae5cf80dbebe33b3f1905547e0ca5e 100644 (file)
@@ -127,7 +127,7 @@ void ccc_key_fini(const struct lu_context *ctx,
 {
        struct ccc_thread_info *info = data;
 
-       OBD_SLAB_FREE_PTR(info, ccc_thread_kmem);
+       kmem_cache_free(ccc_thread_kmem, info);
 }
 
 void *ccc_session_key_init(const struct lu_context *ctx,
@@ -146,7 +146,7 @@ void ccc_session_key_fini(const struct lu_context *ctx,
 {
        struct ccc_session *session = data;
 
-       OBD_SLAB_FREE_PTR(session, ccc_session_kmem);
+       kmem_cache_free(ccc_session_kmem, session);
 }
 
 struct lu_context_key ccc_key = {
@@ -383,7 +383,7 @@ void ccc_object_free(const struct lu_env *env, struct lu_object *obj)
 
        lu_object_fini(obj);
        lu_object_header_fini(obj->lo_header);
-       OBD_SLAB_FREE_PTR(vob, ccc_object_kmem);
+       kmem_cache_free(ccc_object_kmem, vob);
 }
 
 int ccc_lock_init(const struct lu_env *env,
@@ -511,7 +511,7 @@ void ccc_lock_fini(const struct lu_env *env, struct cl_lock_slice *slice)
 {
        struct ccc_lock *clk = cl2ccc_lock(slice);
 
-       OBD_SLAB_FREE_PTR(clk, ccc_lock_kmem);
+       kmem_cache_free(ccc_lock_kmem, clk);
 }
 
 int ccc_lock_enqueue(const struct lu_env *env,
@@ -804,7 +804,7 @@ void ccc_req_completion(const struct lu_env *env,
                cl_stats_tally(slice->crs_dev, slice->crs_req->crq_type, ioret);
 
        vrq = cl2ccc_req(slice);
-       OBD_SLAB_FREE_PTR(vrq, ccc_req_kmem);
+       kmem_cache_free(ccc_req_kmem, vrq);
 }
 
 /**
index f5905098e5e9ad72cf1a77c177dec7984ecdc153..11bf2c60c31ae6c319f6f27c2985dcd44c7b59d4 100644 (file)
@@ -74,7 +74,7 @@ static struct ll_file_data *ll_file_data_get(void)
 static void ll_file_data_put(struct ll_file_data *fd)
 {
        if (fd != NULL)
-               OBD_SLAB_FREE_PTR(fd, ll_file_data_slab);
+               kmem_cache_free(ll_file_data_slab, fd);
 }
 
 void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data,
index 639499482e76b5cb19a96a3616db83b58a9269ff..0131368606644fc0b6ef2259878fefb5c00e50ea 100644 (file)
@@ -66,7 +66,7 @@ static void ll_inode_destroy_callback(struct rcu_head *head)
        struct inode *inode = container_of(head, struct inode, i_rcu);
        struct ll_inode_info *ptr = ll_i2info(inode);
 
-       OBD_SLAB_FREE_PTR(ptr, ll_inode_cachep);
+       kmem_cache_free(ll_inode_cachep, ptr);
 }
 
 static void ll_destroy_inode(struct inode *inode)
index 3fe8e638dcc54fa7dbcedc781f6db5ff90c94185..d16d6cfce81a6b99dffa4afb20d87deaa8a4d13a 100644 (file)
@@ -90,7 +90,7 @@ static void vvp_key_fini(const struct lu_context *ctx,
 {
        struct vvp_thread_info *info = data;
 
-       OBD_SLAB_FREE_PTR(info, vvp_thread_kmem);
+       kmem_cache_free(vvp_thread_kmem, info);
 }
 
 static void *vvp_session_key_init(const struct lu_context *ctx,
@@ -109,7 +109,7 @@ static void vvp_session_key_fini(const struct lu_context *ctx,
 {
        struct vvp_session *session = data;
 
-       OBD_SLAB_FREE_PTR(session, vvp_session_kmem);
+       kmem_cache_free(vvp_session_kmem, session);
 }
 
 struct lu_context_key vvp_key = {
index ca6cddb906db33e4b7b7ca1ec8471ffea5d6decf..e1e599ceb173c4e28d7ef3bb9fe7a0c28a56d1cf 100644 (file)
@@ -141,7 +141,7 @@ static int ll_xattr_cache_add(struct list_head *cache,
 err_value:
        kfree(xattr->xe_name);
 err_name:
-       OBD_SLAB_FREE_PTR(xattr, xattr_kmem);
+       kmem_cache_free(xattr_kmem, xattr);
 
        return -ENOMEM;
 }
@@ -165,7 +165,7 @@ static int ll_xattr_cache_del(struct list_head *cache,
                list_del(&xattr->xe_list);
                kfree(xattr->xe_name);
                kfree(xattr->xe_value);
-               OBD_SLAB_FREE_PTR(xattr, xattr_kmem);
+               kmem_cache_free(xattr_kmem, xattr);
 
                return 0;
        }
index ed36797517c101ca75a27b8a3def69fc311a1f70..2e8b566458f6d6c08d6386a9ca134fcc2a95c415 100644 (file)
@@ -124,7 +124,7 @@ static void lov_req_completion(const struct lu_env *env,
        struct lov_req *lr;
 
        lr = cl2lov_req(slice);
-       OBD_SLAB_FREE_PTR(lr, lov_req_kmem);
+       kmem_cache_free(lov_req_kmem, lr);
 }
 
 static const struct cl_req_operations lov_req_ops = {
@@ -156,7 +156,7 @@ static void lov_key_fini(const struct lu_context *ctx,
        struct lov_thread_info *info = data;
 
        LINVRNT(list_empty(&info->lti_closure.clc_list));
-       OBD_SLAB_FREE_PTR(info, lov_thread_kmem);
+       kmem_cache_free(lov_thread_kmem, info);
 }
 
 struct lu_context_key lov_key = {
@@ -181,7 +181,7 @@ static void lov_session_key_fini(const struct lu_context *ctx,
 {
        struct lov_session *info = data;
 
-       OBD_SLAB_FREE_PTR(info, lov_session_kmem);
+       kmem_cache_free(lov_session_kmem, info);
 }
 
 struct lu_context_key lov_session_key = {
index fe126a7739928c8691e8dd491d0e23fed7e88024..d866791d7b22748fed6ea28003af5893fd095881 100644 (file)
@@ -173,7 +173,7 @@ static struct cl_lock *lov_sublock_alloc(const struct lu_env *env,
                if (!IS_ERR(sublock))
                        *out = link;
                else
-                       OBD_SLAB_FREE_PTR(link, lov_lock_link_kmem);
+                       kmem_cache_free(lov_lock_link_kmem, link);
        } else
                sublock = ERR_PTR(-ENOMEM);
        return sublock;
@@ -444,7 +444,7 @@ static void lov_lock_fini(const struct lu_env *env,
                        LASSERT(lck->lls_sub[i].sub_lock == NULL);
                kvfree(lck->lls_sub);
        }
-       OBD_SLAB_FREE_PTR(lck, lov_lock_kmem);
+       kmem_cache_free(lov_lock_kmem, lck);
 }
 
 static int lov_lock_enqueue_wait(const struct lu_env *env,
@@ -518,7 +518,7 @@ static int lov_sublock_fill(const struct lu_env *env, struct cl_lock *parent,
                    lck->lls_sub[idx].sub_lock == NULL) {
                        lov_sublock_adopt(env, lck, sublock, idx, link);
                } else {
-                       OBD_SLAB_FREE_PTR(link, lov_lock_link_kmem);
+                       kmem_cache_free(lov_lock_link_kmem, link);
                        /* other thread allocated sub-lock, or enqueue is no
                         * longer going on */
                        cl_lock_mutex_put(env, parent);
@@ -1027,7 +1027,7 @@ void lov_lock_unlink(const struct lu_env *env,
        lck->lls_nr_filled--;
        lu_ref_del(&parent->cll_reference, "lov-child", sub->lss_cl.cls_lock);
        cl_lock_put(env, parent);
-       OBD_SLAB_FREE_PTR(link, lov_lock_link_kmem);
+       kmem_cache_free(lov_lock_link_kmem, link);
 }
 
 struct lov_lock_link *lov_lock_link_find(const struct lu_env *env,
@@ -1153,7 +1153,7 @@ static void lov_empty_lock_fini(const struct lu_env *env,
 {
        struct lov_lock *lck = cl2lov_lock(slice);
 
-       OBD_SLAB_FREE_PTR(lck, lov_lock_kmem);
+       kmem_cache_free(lov_lock_kmem, lck);
 }
 
 static int lov_empty_lock_print(const struct lu_env *env, void *cookie,
index 571a06e906142c8f65b7fc4884aabcd747aaff3b..c7ff817bb6fb098dfd34771d17d395505a0cd3de 100644 (file)
@@ -808,7 +808,7 @@ static void lov_object_free(const struct lu_env *env, struct lu_object *obj)
 
        LOV_2DISPATCH_VOID(lov, llo_fini, env, lov, &lov->u);
        lu_object_fini(obj);
-       OBD_SLAB_FREE_PTR(lov, lov_object_kmem);
+       kmem_cache_free(lov_object_kmem, lov);
 }
 
 static int lov_object_print(const struct lu_env *env, void *cookie,
index 5053bfba20fe59ce76d629ec625a5751f4d2bf8a..8bc04c8d3d600bb797d68cc81bec024a02afdc39 100644 (file)
@@ -56,7 +56,7 @@ static void lovsub_req_completion(const struct lu_env *env,
        struct lovsub_req *lsr;
 
        lsr = cl2lovsub_req(slice);
-       OBD_SLAB_FREE_PTR(lsr, lovsub_req_kmem);
+       kmem_cache_free(lovsub_req_kmem, lsr);
 }
 
 /**
index 88373e8410c02f7c1753af49caf30f2c4d8b930e..1a3e30a14895726694cfd3b617bcaa460badb19a 100644 (file)
@@ -59,7 +59,7 @@ static void lovsub_lock_fini(const struct lu_env *env,
 
        lsl = cl2lovsub_lock(slice);
        LASSERT(list_empty(&lsl->lss_parents));
-       OBD_SLAB_FREE_PTR(lsl, lovsub_lock_kmem);
+       kmem_cache_free(lovsub_lock_kmem, lsl);
 }
 
 static void lovsub_parent_lock(const struct lu_env *env, struct lov_lock *lov)
index 5c94d0bebaf1ac1c9b49b301fbf67008427dba06..d775e28d40973d02a52bfdc51869567c12a95086 100644 (file)
@@ -91,7 +91,7 @@ static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj)
 
        lu_object_fini(obj);
        lu_object_header_fini(&los->lso_header.coh_lu);
-       OBD_SLAB_FREE_PTR(los, lovsub_object_kmem);
+       kmem_cache_free(lovsub_object_kmem, los);
 }
 
 static int lovsub_object_print(const struct lu_env *env, void *cookie,
index b9227ab254bdcfb9d88f98a94f491c4db9073be6..5621bebf33a9d3dc7fea98e8b4e0e45207e90a38 100644 (file)
@@ -270,7 +270,7 @@ static void cl_lock_free(const struct lu_env *env, struct cl_lock *lock)
        lu_ref_fini(&lock->cll_reference);
        lu_ref_fini(&lock->cll_holders);
        mutex_destroy(&lock->cll_guard);
-       OBD_SLAB_FREE_PTR(lock, cl_lock_kmem);
+       kmem_cache_free(cl_lock_kmem, lock);
 }
 
 /**
index b7d0f2649e1e8c3c21ce0dfd7f7064f7a8fb0811..f59c03cd47052a89062b75ecb639bd0eab64f771 100644 (file)
@@ -680,7 +680,7 @@ static struct lu_env *cl_env_new(__u32 ctx_tags, __u32 ses_tags, void *debug)
                                lu_env_fini(env);
                }
                if (rc != 0) {
-                       OBD_SLAB_FREE_PTR(cle, cl_env_kmem);
+                       kmem_cache_free(cl_env_kmem, cle);
                        env = ERR_PTR(rc);
                } else {
                        CL_ENV_INC(create);
@@ -696,7 +696,7 @@ static void cl_env_fini(struct cl_env *cle)
        CL_ENV_DEC(total);
        lu_context_fini(&cle->ce_lu.le_ctx);
        lu_context_fini(&cle->ce_ses);
-       OBD_SLAB_FREE_PTR(cle, cl_env_kmem);
+       kmem_cache_free(cl_env_kmem, cle);
 }
 
 static inline struct cl_env *cl_env_container(struct lu_env *env)
index 6fd58895703d5f404a3130b4266c5dba106597eb..6477aeb88028c93573192d0fce8b09e00ddb58b6 100644 (file)
@@ -85,7 +85,7 @@ static void obd_device_free(struct obd_device *obd)
                LBUG();
        }
        lu_ref_fini(&obd->obd_reference);
-       OBD_SLAB_FREE_PTR(obd, obd_device_cachep);
+       kmem_cache_free(obd_device_cachep, obd);
 }
 
 static struct obd_type *class_search_type(const char *name)
index 19d1664c939233c08fb66b7ba11299a6191d3a3d..6751382ce338c0f96a52e2fe4f01be3d89d89226 100644 (file)
@@ -337,7 +337,7 @@ static void echo_lock_fini(const struct lu_env *env,
        struct echo_lock *ecl = cl2echo_lock(slice);
 
        LASSERT(list_empty(&ecl->el_chain));
-       OBD_SLAB_FREE_PTR(ecl, echo_lock_kmem);
+       kmem_cache_free(echo_lock_kmem, ecl);
 }
 
 static void echo_lock_delete(const struct lu_env *env,
@@ -530,7 +530,7 @@ static void echo_object_free(const struct lu_env *env, struct lu_object *obj)
 
        if (eco->eo_lsm)
                echo_free_memmd(eco->eo_dev, &eco->eo_lsm);
-       OBD_SLAB_FREE_PTR(eco, echo_object_kmem);
+       kmem_cache_free(echo_object_kmem, eco);
 }
 
 static int echo_object_print(const struct lu_env *env, void *cookie,
@@ -641,7 +641,7 @@ static void echo_thread_key_fini(const struct lu_context *ctx,
 {
        struct echo_thread_info *info = data;
 
-       OBD_SLAB_FREE_PTR(info, echo_thread_kmem);
+       kmem_cache_free(echo_thread_kmem, info);
 }
 
 static void echo_thread_key_exit(const struct lu_context *ctx,
@@ -672,7 +672,7 @@ static void echo_session_key_fini(const struct lu_context *ctx,
 {
        struct echo_session_info *session = data;
 
-       OBD_SLAB_FREE_PTR(session, echo_session_kmem);
+       kmem_cache_free(echo_session_kmem, session);
 }
 
 static void echo_session_key_exit(const struct lu_context *ctx,
index dae13d9522f3a45dd2e830035e233d3ccfbc52fa..cfb83bcfcb17525ac99e7f08b428fde98e86316c 100644 (file)
@@ -365,7 +365,7 @@ static struct osc_extent *osc_extent_alloc(struct osc_object *obj)
 
 static void osc_extent_free(struct osc_extent *ext)
 {
-       OBD_SLAB_FREE_PTR(ext, osc_extent_kmem);
+       kmem_cache_free(osc_extent_kmem, ext);
 }
 
 static struct osc_extent *osc_extent_get(struct osc_extent *ext)
index f10757ef65d367112908ea7d031f265786058821..69b523c0f570263cb0a32eedd699f2b115a44829 100644 (file)
@@ -133,7 +133,7 @@ static void osc_key_fini(const struct lu_context *ctx,
 {
        struct osc_thread_info *info = data;
 
-       OBD_SLAB_FREE_PTR(info, osc_thread_kmem);
+       kmem_cache_free(osc_thread_kmem, info);
 }
 
 struct lu_context_key osc_key = {
@@ -158,7 +158,7 @@ static void osc_session_fini(const struct lu_context *ctx,
 {
        struct osc_session *info = data;
 
-       OBD_SLAB_FREE_PTR(info, osc_session_kmem);
+       kmem_cache_free(osc_session_kmem, info);
 }
 
 struct lu_context_key osc_session_key = {
index 9f995e7aea950e3cd5f4c612bfb41a8ed4ea477f..d413496c0f63276b08caf6e9740567556cb7fb20 100644 (file)
@@ -700,7 +700,7 @@ static void osc_req_completion(const struct lu_env *env,
        struct osc_req *or;
 
        or = cl2osc_req(slice);
-       OBD_SLAB_FREE_PTR(or, osc_req_kmem);
+       kmem_cache_free(osc_req_kmem, or);
 }
 
 /**
index fbeaa1dabbeb8132ffa5ebca23e5a6d91fdce76c..194490dcaca9e0f6d4a7c5ad6b25ced9645edbb0 100644 (file)
@@ -251,7 +251,7 @@ static void osc_lock_fini(const struct lu_env *env,
        LASSERT(atomic_read(&ols->ols_pageref) == 0 ||
                atomic_read(&ols->ols_pageref) == _PAGEREF_MAGIC);
 
-       OBD_SLAB_FREE_PTR(ols, osc_lock_kmem);
+       kmem_cache_free(osc_lock_kmem, ols);
 }
 
 static void osc_lock_build_policy(const struct lu_env *env,
index 5ed88ae741437d8eff74c7213b2e1eb34eda7bf1..ba57f8df5c7f7a63a77465376c46d482c14a4b30 100644 (file)
@@ -122,7 +122,7 @@ static void osc_object_free(const struct lu_env *env, struct lu_object *obj)
        LASSERT(atomic_read(&osc->oo_nr_writes) == 0);
 
        lu_object_fini(obj);
-       OBD_SLAB_FREE_PTR(osc, osc_object_kmem);
+       kmem_cache_free(osc_object_kmem, osc);
 }
 
 int osc_lvb_print(const struct lu_env *env, void *cookie,
index 98b9bcda798106f7dc14761e7dad9773fb2132bc..df8cfb4fde2816268f20ae036e5c98d10f8bd5e2 100644 (file)
@@ -104,7 +104,7 @@ int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
                        /* race with others? */
                        if (rc == -EALREADY) {
                                rc = 0;
-                               OBD_SLAB_FREE_PTR(oqi, osc_quota_kmem);
+                               kmem_cache_free(osc_quota_kmem, oqi);
                        }
 
                        CDEBUG(D_QUOTA, "%s: setdq to insert for %s %d (%d)\n",
@@ -120,7 +120,7 @@ int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
                        oqi = cfs_hash_del_key(cli->cl_quota_hash[type],
                                               &qid[type]);
                        if (oqi)
-                               OBD_SLAB_FREE_PTR(oqi, osc_quota_kmem);
+                               kmem_cache_free(osc_quota_kmem, oqi);
 
                        CDEBUG(D_QUOTA, "%s: setdq to remove for %s %d (%p)\n",
                               cli->cl_import->imp_obd->obd_name,
@@ -186,7 +186,7 @@ oqi_exit(struct cfs_hash *hs, struct hlist_node *hnode)
 
        oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash);
 
-       OBD_SLAB_FREE_PTR(oqi, osc_quota_kmem);
+       kmem_cache_free(osc_quota_kmem, oqi);
 }
 
 #define HASH_QUOTA_BKT_BITS 5
index bda63aaf1ad0901e12a51180d7e248bf61f1b7c7..a9f1bf536da9b014b010c7aef2164b3e6e58ae08 100644 (file)
@@ -429,7 +429,7 @@ struct ptlrpc_request *ptlrpc_request_cache_alloc(gfp_t flags)
 
 void ptlrpc_request_cache_free(struct ptlrpc_request *req)
 {
-       OBD_SLAB_FREE_PTR(req, request_cache);
+       kmem_cache_free(request_cache, req);
 }
 
 /**