size_t nob);
int cl_io_cancel (const struct lu_env *env, struct cl_io *io,
struct cl_page_list *queue);
-int cl_io_is_going (const struct lu_env *env);
/**
* True, iff \a io is an O_APPEND write(2).
#ifndef _CL_INTERNAL_H
#define _CL_INTERNAL_H
-#define CLT_PVEC_SIZE (14)
-
-/**
- * Possible levels of the nesting. Currently this is 2: there are "top"
- * entities (files, extent locks), and "sub" entities (stripes and stripe
- * locks). This is used only for debugging counters right now.
- */
-enum clt_nesting_level {
- CNL_TOP,
- CNL_SUB,
- CNL_NR
-};
-
/**
* Thread local state internal for generic cl-code.
*/
struct cl_thread_info {
- /*
- * Common fields.
- */
- struct cl_io clt_io;
- struct cl_2queue clt_queue;
-
- /*
- * Fields used by cl_lock.c
- */
- struct cl_lock_descr clt_descr;
- struct cl_page_list clt_list;
- /** @} debugging */
-
- /*
- * Fields used by cl_page.c
- */
- struct cl_page *clt_pvec[CLT_PVEC_SIZE];
-
- /*
- * Fields used by cl_io.c
- */
- /**
- * Pointer to the topmost ongoing IO in this thread.
- */
- struct cl_io *clt_current_io;
- /**
- * Used for submitting a sync io.
- */
- struct cl_sync_io clt_anchor;
- /**
- * Fields used by cl_lock_discard_pages().
- */
- pgoff_t clt_next_index;
- pgoff_t clt_fn_index; /* first non-overlapped index */
+ /**
+ * Used for submitting a sync I/O.
+ */
+ struct cl_sync_io clt_anchor;
};
struct cl_thread_info *cl_env_info(const struct lu_env *env);
void cl_page_disown0(const struct lu_env *env,
struct cl_io *io, struct cl_page *pg);
-
#endif /* _CL_INTERNAL_H */
}
/**
- * Returns true iff there is an IO ongoing in the given environment.
- */
-int cl_io_is_going(const struct lu_env *env)
-{
- return cl_env_info(env)->clt_current_io != NULL;
-}
-
-/**
* cl_io invariant that holds at all times when exported cl_io_*() functions
* are entered and left.
*/
void cl_io_fini(const struct lu_env *env, struct cl_io *io)
{
struct cl_io_slice *slice;
- struct cl_thread_info *info;
LINVRNT(cl_io_type_is_valid(io->ci_type));
LINVRNT(cl_io_invariant(io));
slice->cis_io = NULL;
}
io->ci_state = CIS_FINI;
- info = cl_env_info(env);
- if (info->clt_current_io == io)
- info->clt_current_io = NULL;
/* sanity check for layout change */
switch(io->ci_type) {
int cl_io_sub_init(const struct lu_env *env, struct cl_io *io,
enum cl_io_type iot, struct cl_object *obj)
{
- struct cl_thread_info *info = cl_env_info(env);
-
LASSERT(obj != cl_object_top(obj));
- if (info->clt_current_io == NULL)
- info->clt_current_io = io;
+
return cl_io_init0(env, io, iot, obj);
}
EXPORT_SYMBOL(cl_io_sub_init);
int cl_io_init(const struct lu_env *env, struct cl_io *io,
enum cl_io_type iot, struct cl_object *obj)
{
- struct cl_thread_info *info = cl_env_info(env);
-
LASSERT(obj == cl_object_top(obj));
- LASSERT(info->clt_current_io == NULL);
- info->clt_current_io = io;
return cl_io_init0(env, io, iot, obj);
}
EXPORT_SYMBOL(cl_io_init);
return lu_context_key_get(&env->le_ctx, &cl_key);
}
-/* defines cl0_key_{init,fini}() */
-LU_KEY_INIT_FINI(cl0, struct cl_thread_info);
-
-static void *cl_key_init(const struct lu_context *ctx,
- struct lu_context_key *key)
-{
- return cl0_key_init(ctx, key);
-}
-
-static void cl_key_fini(const struct lu_context *ctx,
- struct lu_context_key *key, void *data)
-{
- cl0_key_fini(ctx, key, data);
-}
+/* defines cl_key_{init,fini}() */
+LU_KEY_INIT_FINI(cl, struct cl_thread_info);
static struct lu_context_key cl_key = {
.lct_tags = LCT_CL_THREAD,