These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / lustre / lustre / lclient / lcommon_cl.c
index ab6cb41..0b8e4d2 100644 (file)
@@ -116,7 +116,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key)
 {
        struct ccc_thread_info *info;
 
-       OBD_SLAB_ALLOC_PTR_GFP(info, ccc_thread_kmem, GFP_NOFS);
+       info = kmem_cache_alloc(ccc_thread_kmem, GFP_NOFS | __GFP_ZERO);
        if (info == NULL)
                info = ERR_PTR(-ENOMEM);
        return info;
@@ -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,
@@ -135,7 +135,7 @@ void *ccc_session_key_init(const struct lu_context *ctx,
 {
        struct ccc_session *session;
 
-       OBD_SLAB_ALLOC_PTR_GFP(session, ccc_session_kmem, GFP_NOFS);
+       session = kmem_cache_alloc(ccc_session_kmem, GFP_NOFS | __GFP_ZERO);
        if (session == NULL)
                session = ERR_PTR(-ENOMEM);
        return session;
@@ -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 = {
@@ -161,7 +161,6 @@ struct lu_context_key ccc_session_key = {
        .lct_fini = ccc_session_key_fini
 };
 
-
 /* type constructor/destructor: ccc_type_{init,fini,start,stop}(). */
 /* LU_TYPE_INIT_FINI(ccc, &ccc_key, &ccc_session_key); */
 
@@ -202,8 +201,8 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env,
        struct cl_site    *site;
        int rc;
 
-       OBD_ALLOC_PTR(vdv);
-       if (vdv == NULL)
+       vdv = kzalloc(sizeof(*vdv), GFP_NOFS);
+       if (!vdv)
                return ERR_PTR(-ENOMEM);
 
        lud = &vdv->cdv_cl.cd_lu_dev;
@@ -211,7 +210,7 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env,
        ccc2lu_dev(vdv)->ld_ops = luops;
        vdv->cdv_cl.cd_ops = clops;
 
-       OBD_ALLOC_PTR(site);
+       site = kzalloc(sizeof(*site), GFP_NOFS);
        if (site != NULL) {
                rc = cl_site_init(site, &vdv->cdv_cl);
                if (rc == 0)
@@ -219,7 +218,7 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env,
                else {
                        LASSERT(lud->ld_site == NULL);
                        CERROR("Cannot init lu_site, rc %d.\n", rc);
-                       OBD_FREE_PTR(site);
+                       kfree(site);
                }
        } else
                rc = -ENOMEM;
@@ -239,10 +238,10 @@ struct lu_device *ccc_device_free(const struct lu_env *env,
 
        if (d->ld_site != NULL) {
                cl_site_fini(site);
-               OBD_FREE_PTR(site);
+               kfree(site);
        }
        cl_device_fini(lu2cl_dev(d));
-       OBD_FREE_PTR(vdv);
+       kfree(vdv);
        return next;
 }
 
@@ -252,7 +251,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev,
        struct ccc_req *vrq;
        int result;
 
-       OBD_SLAB_ALLOC_PTR_GFP(vrq, ccc_req_kmem, GFP_NOFS);
+       vrq = kmem_cache_alloc(ccc_req_kmem, GFP_NOFS | __GFP_ZERO);
        if (vrq != NULL) {
                cl_req_slice_add(req, &vrq->crq_cl, dev, &ccc_req_ops);
                result = 0;
@@ -328,7 +327,7 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env,
        struct ccc_object *vob;
        struct lu_object  *obj;
 
-       OBD_SLAB_ALLOC_PTR_GFP(vob, ccc_object_kmem, GFP_NOFS);
+       vob = kmem_cache_alloc(ccc_object_kmem, GFP_NOFS | __GFP_ZERO);
        if (vob != NULL) {
                struct cl_object_header *hdr;
 
@@ -384,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,
@@ -397,7 +396,7 @@ int ccc_lock_init(const struct lu_env *env,
 
        CLOBINVRNT(env, obj, ccc_object_invariant(obj));
 
-       OBD_SLAB_ALLOC_PTR_GFP(clk, ccc_lock_kmem, GFP_NOFS);
+       clk = kmem_cache_alloc(ccc_lock_kmem, GFP_NOFS | __GFP_ZERO);
        if (clk != NULL) {
                cl_lock_slice_add(lock, &clk->clk_cl, obj, lkops);
                result = 0;
@@ -406,12 +405,6 @@ int ccc_lock_init(const struct lu_env *env,
        return result;
 }
 
-int ccc_attr_set(const struct lu_env *env, struct cl_object *obj,
-                const struct cl_attr *attr, unsigned valid)
-{
-       return 0;
-}
-
 int ccc_object_glimpse(const struct lu_env *env,
                       const struct cl_object *obj, struct ost_lvb *lvb)
 {
@@ -430,15 +423,6 @@ int ccc_object_glimpse(const struct lu_env *env,
        return 0;
 }
 
-
-
-int ccc_conf_set(const struct lu_env *env, struct cl_object *obj,
-                       const struct cl_object_conf *conf)
-{
-       /* TODO: destroy all pages attached to this object. */
-       return 0;
-}
-
 static void ccc_object_size_lock(struct cl_object *obj)
 {
        struct inode *inode = ccc_object_inode(obj);
@@ -503,54 +487,6 @@ int ccc_fail(const struct lu_env *env, const struct cl_page_slice *slice)
        return 0;
 }
 
-void ccc_transient_page_verify(const struct cl_page *page)
-{
-}
-
-int ccc_transient_page_own(const struct lu_env *env,
-                                  const struct cl_page_slice *slice,
-                                  struct cl_io *unused,
-                                  int nonblock)
-{
-       ccc_transient_page_verify(slice->cpl_page);
-       return 0;
-}
-
-void ccc_transient_page_assume(const struct lu_env *env,
-                                     const struct cl_page_slice *slice,
-                                     struct cl_io *unused)
-{
-       ccc_transient_page_verify(slice->cpl_page);
-}
-
-void ccc_transient_page_unassume(const struct lu_env *env,
-                                       const struct cl_page_slice *slice,
-                                       struct cl_io *unused)
-{
-       ccc_transient_page_verify(slice->cpl_page);
-}
-
-void ccc_transient_page_disown(const struct lu_env *env,
-                                     const struct cl_page_slice *slice,
-                                     struct cl_io *unused)
-{
-       ccc_transient_page_verify(slice->cpl_page);
-}
-
-void ccc_transient_page_discard(const struct lu_env *env,
-                                      const struct cl_page_slice *slice,
-                                      struct cl_io *unused)
-{
-       struct cl_page *page = slice->cpl_page;
-
-       ccc_transient_page_verify(slice->cpl_page);
-
-       /*
-        * For transient pages, remove it from the radix tree.
-        */
-       cl_page_delete(env, page);
-}
-
 int ccc_transient_page_prep(const struct lu_env *env,
                                   const struct cl_page_slice *slice,
                                   struct cl_io *unused)
@@ -575,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,
@@ -690,13 +626,6 @@ void ccc_lock_state(const struct lu_env *env,
  *
  */
 
-void ccc_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
-{
-       struct cl_io *io = ios->cis_io;
-
-       CLOBINVRNT(env, io->ci_obj, ccc_object_invariant(io->ci_obj));
-}
-
 int ccc_io_one_lock_index(const struct lu_env *env, struct cl_io *io,
                          __u32 enqflags, enum cl_lock_mode mode,
                          pgoff_t start, pgoff_t end)
@@ -836,25 +765,24 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
                                        *exceed = 1;
                        }
                        return result;
-               } else {
-                       /*
-                        * region is within kms and, hence, within real file
-                        * size (A). We need to increase i_size to cover the
-                        * read region so that generic_file_read() will do its
-                        * job, but that doesn't mean the kms size is
-                        * _correct_, it is only the _minimum_ size. If
-                        * someone does a stat they will get the correct size
-                        * which will always be >= the kms value here.
-                        * b=11081
-                        */
-                       if (cl_isize_read(inode) < kms) {
-                               cl_isize_write_nolock(inode, kms);
-                               CDEBUG(D_VFSTRACE,
-                                      DFID" updating i_size %llu\n",
-                                      PFID(lu_object_fid(&obj->co_lu)),
-                                      (__u64)cl_isize_read(inode));
+               }
+               /*
+                * region is within kms and, hence, within real file
+                * size (A). We need to increase i_size to cover the
+                * read region so that generic_file_read() will do its
+                * job, but that doesn't mean the kms size is
+                * _correct_, it is only the _minimum_ size. If
+                * someone does a stat they will get the correct size
+                * which will always be >= the kms value here.
+                * b=11081
+                */
+               if (cl_isize_read(inode) < kms) {
+                       cl_isize_write_nolock(inode, kms);
+                       CDEBUG(D_VFSTRACE,
+                                       DFID" updating i_size %llu\n",
+                                       PFID(lu_object_fid(&obj->co_lu)),
+                                       (__u64)cl_isize_read(inode));
 
-                       }
                }
        }
        ccc_object_size_unlock(obj);
@@ -876,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);
 }
 
 /**
@@ -897,7 +825,6 @@ void ccc_req_completion(const struct lu_env *env,
  *
  *    - o_ioepoch,
  *
- *  and capability.
  */
 void ccc_req_attr_set(const struct lu_env *env,
                      const struct cl_req_slice *slice,
@@ -912,12 +839,6 @@ void ccc_req_attr_set(const struct lu_env *env,
        inode = ccc_object_inode(obj);
        valid_flags = OBD_MD_FLTYPE;
 
-       if ((flags & OBD_MD_FLOSSCAPA) != 0) {
-               LASSERT(attr->cra_capa == NULL);
-               attr->cra_capa = cl_capa_lookup(inode,
-                                               slice->crs_req->crq_type);
-       }
-
        if (slice->crs_req->crq_type == CRT_WRITE) {
                if (flags & OBD_MD_FLEPOCH) {
                        oa->o_valid |= OBD_MD_FLEPOCH;
@@ -937,8 +858,7 @@ static const struct cl_req_operations ccc_req_ops = {
        .cro_completion = ccc_req_completion
 };
 
-int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
-                  struct obd_capa *capa)
+int cl_setattr_ost(struct inode *inode, const struct iattr *attr)
 {
        struct lu_env *env;
        struct cl_io  *io;
@@ -957,7 +877,6 @@ int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
        io->u.ci_setattr.sa_attr.lvb_ctime = LTIME_S(attr->ia_ctime);
        io->u.ci_setattr.sa_attr.lvb_size = attr->ia_size;
        io->u.ci_setattr.sa_valid = attr->ia_valid;
-       io->u.ci_setattr.sa_capa = capa;
 
 again:
        if (cl_io_init(env, io, CIT_SETATTR, io->ci_obj) == 0) {