Whamcloud - gitweb
LU-13134 obdclass: use slab allocation for cl_dio_aio
[fs/lustre-release.git] / lustre / obdclass / cl_object.c
index 2914017..1e39da3 100644 (file)
@@ -48,7 +48,6 @@
 
 #include <linux/list.h>
 #include <libcfs/libcfs.h>
-/* class_put_type() */
 #include <obd_class.h>
 #include <obd_support.h>
 #include <lustre_fid.h>
@@ -58,6 +57,7 @@
 #include "cl_internal.h"
 
 static struct kmem_cache *cl_env_kmem;
+struct kmem_cache *cl_dio_aio_kmem;
 
 /** Lock class of cl_object_header::coh_attr_guard */
 static struct lock_class_key cl_attr_guard_class;
@@ -422,6 +422,24 @@ loff_t cl_object_maxbytes(struct cl_object *obj)
 }
 EXPORT_SYMBOL(cl_object_maxbytes);
 
+int cl_object_flush(const struct lu_env *env, struct cl_object *obj,
+                        struct ldlm_lock *lock)
+{
+       struct lu_object_header *top = obj->co_lu.lo_header;
+       int rc = 0;
+       ENTRY;
+
+       list_for_each_entry(obj, &top->loh_layers, co_lu.lo_linkage) {
+               if (obj->co_ops->coo_object_flush) {
+                       rc = obj->co_ops->coo_object_flush(env, obj, lock);
+                       if (rc)
+                               break;
+               }
+       }
+       RETURN(rc);
+}
+EXPORT_SYMBOL(cl_object_flush);
+
 /**
  * Helper function removing all object locks, and marking object for
  * deletion. All object pages must have been deleted at this point.
@@ -824,8 +842,8 @@ void cl_env_put(struct lu_env *env, __u16 *refcheck)
                 * with the standard tags.
                 */
                if (cl_envs[cpu].cec_count < cl_envs_cached_max &&
-                   (env->le_ctx.lc_tags & ~LCT_HAS_EXIT) == LCT_CL_THREAD &&
-                   (env->le_ses->lc_tags & ~LCT_HAS_EXIT) == LCT_SESSION) {
+                   (env->le_ctx.lc_tags & ~LCT_HAS_EXIT) == lu_context_tags_default &&
+                   (env->le_ses->lc_tags & ~LCT_HAS_EXIT) == lu_session_tags_default) {
                        read_lock(&cl_envs[cpu].cec_guard);
                        list_add(&cle->ce_linkage, &cl_envs[cpu].cec_envs);
                        cl_envs[cpu].cec_count++;
@@ -954,7 +972,7 @@ void cl_env_percpu_put(struct lu_env *env)
 }
 EXPORT_SYMBOL(cl_env_percpu_put);
 
-struct lu_env *cl_env_percpu_get()
+struct lu_env *cl_env_percpu_get(void)
 {
        struct cl_env *cle;
 
@@ -1029,14 +1047,19 @@ static struct lu_context_key cl_key = {
 };
 
 static struct lu_kmem_descr cl_object_caches[] = {
-        {
-                .ckd_cache = &cl_env_kmem,
-                .ckd_name  = "cl_env_kmem",
-                .ckd_size  = sizeof (struct cl_env)
-        },
-        {
-                .ckd_cache = NULL
-        }
+       {
+               .ckd_cache = &cl_env_kmem,
+               .ckd_name  = "cl_env_kmem",
+               .ckd_size  = sizeof(struct cl_env)
+       },
+       {
+               .ckd_cache = &cl_dio_aio_kmem,
+               .ckd_name  = "cl_dio_aio_kmem",
+               .ckd_size  = sizeof(struct cl_dio_aio)
+       },
+       {
+               .ckd_cache = NULL
+       }
 };
 
 /**