* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2016, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <linux/list.h>
#include <libcfs/libcfs.h>
-/* class_put_type() */
#include <obd_class.h>
#include <obd_support.h>
#include <lustre_fid.h>
#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;
}
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.
/**
* The most efficient way is to store cl_env pointer in task specific
- * structures. On Linux, it wont' be easy to use task_struct->journal_info
- * because Lustre code may call into other fs which has certain assumptions
- * about journal_info. Currently following fields in task_struct are identified
- * can be used for this purpose:
- * - cl_env: for liblustre.
- * - tux_info: ony on RedHat kernel.
- * - ...
+ * structures. On Linux, it isn't easy to use task_struct->journal_info
+ * because Lustre code may call into other fs during memory reclaim, which
+ * has certain assumptions about journal_info. There are not currently any
+ * fields in task_struct that can be used for this purpose.
* \note As long as we use task_struct to store cl_env, we assume that once
* called into Lustre, we'll never call into the other part of the kernel
* which will use those fields in task_struct without explicitly exiting
* Lustre.
*
- * If there's no space in task_struct is available, hash will be used.
+ * Since there's no space in task_struct is available, hash will be used.
* bz20044, bz22683.
*/
* 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++;
*/
void cl_attr2lvb(struct ost_lvb *lvb, const struct cl_attr *attr)
{
- ENTRY;
lvb->lvb_size = attr->cat_size;
lvb->lvb_mtime = attr->cat_mtime;
lvb->lvb_atime = attr->cat_atime;
lvb->lvb_ctime = attr->cat_ctime;
lvb->lvb_blocks = attr->cat_blocks;
- EXIT;
}
/**
*/
void cl_lvb2attr(struct cl_attr *attr, const struct ost_lvb *lvb)
{
- ENTRY;
attr->cat_size = lvb->lvb_size;
attr->cat_mtime = lvb->lvb_mtime;
attr->cat_atime = lvb->lvb_atime;
attr->cat_ctime = lvb->lvb_ctime;
attr->cat_blocks = lvb->lvb_blocks;
- EXIT;
}
EXPORT_SYMBOL(cl_lvb2attr);
}
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;
};
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
+ }
};
-struct cfs_ptask_engine *cl_io_engine;
-
/**
* Global initialization of cl-data. Create kmem caches, register
* lu_context_key's, etc.
if (result) /* no cl_env_percpu_fini on error */
GOTO(out_keys, result);
- cl_io_engine = cfs_ptengine_init("clio", cpu_online_mask);
- if (IS_ERR(cl_io_engine)) {
- result = PTR_ERR(cl_io_engine);
- cl_io_engine = NULL;
- GOTO(out_percpu, result);
- }
-
return 0;
-out_percpu:
- cl_env_percpu_fini();
out_keys:
lu_context_key_degister(&cl_key);
out_kmem:
*/
void cl_global_fini(void)
{
- cfs_ptengine_fini(cl_io_engine);
- cl_io_engine = NULL;
cl_env_percpu_fini();
lu_context_key_degister(&cl_key);
lu_kmem_fini(cl_object_caches);