Remove legacy io completion API

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2018-12-12 09:19:34 +01:00
parent c0079e4d77
commit d862778e2b
32 changed files with 195 additions and 269 deletions

View File

@@ -147,7 +147,7 @@ void ocf_metadata_flush_mark(struct ocf_cache *cache, struct ocf_request *rq,
}
void ocf_metadata_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, ocf_end_t complete)
struct ocf_request *rq, ocf_req_end_t complete)
{
cache->metadata.iface.flush_do_asynch(cache, rq, complete);
}

View File

@@ -257,7 +257,7 @@ void ocf_metadata_flush_mark(struct ocf_cache *cache, struct ocf_request *rq,
* @param context - context that will be passed into callback
*/
void ocf_metadata_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, ocf_end_t complete);
struct ocf_request *rq, ocf_req_end_t complete);
/**
* @brief Load metadata

View File

@@ -1231,7 +1231,7 @@ static void ocf_metadata_hash_flush_mark(struct ocf_cache *cache,
* Flush specified cache lines asynchronously
*/
static void ocf_metadata_hash_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, ocf_metadata_asynch_flush_hndl complete)
struct ocf_request *rq, ocf_req_end_t complete)
{
int result = 0;
struct ocf_metadata_hash_ctrl *ctrl = NULL;

View File

@@ -32,7 +32,8 @@
#define OCF_DEBUG_PARAM(cache, format, ...)
#endif
static void metadata_io_write_i_end_asynch(void *private_data, int error);
static void metadata_io_write_i_asynch_end(struct metadata_io_request *request,
int error);
static int ocf_restart_meta_io(struct ocf_request *req);
static struct ocf_io_if meta_restart_if = {
@@ -146,6 +147,13 @@ int metadata_io_read_i_atomic(struct ocf_cache *cache,
return result;
}
static void metadata_io_write_i_asynch_cmpl(struct ocf_io *io, int error)
{
struct metadata_io_request *request = io->priv1;
metadata_io_write_i_asynch_end(request, error);
}
static int ocf_restart_meta_io(struct ocf_request *req)
{
struct ocf_io *io;
@@ -168,7 +176,7 @@ static int ocf_restart_meta_io(struct ocf_request *req)
io = ocf_new_cache_io(cache);
if (!io) {
metadata_io_write_i_end_asynch(meta_io_req, -ENOMEM);
metadata_io_write_i_asynch_end(meta_io_req, -ENOMEM);
return 0;
}
@@ -178,12 +186,11 @@ static int ocf_restart_meta_io(struct ocf_request *req)
PAGES_TO_BYTES(meta_io_req->count),
OCF_WRITE, 0, 0);
ocf_io_set_default_cmpl(io, meta_io_req,
metadata_io_write_i_end_asynch);
ocf_io_set_cmpl(io, meta_io_req, NULL, metadata_io_write_i_asynch_cmpl);
ret = ocf_io_set_data(io, meta_io_req->data, 0);
if (ret) {
ocf_io_put(io);
metadata_io_write_i_end_asynch(meta_io_req, ret);
metadata_io_write_i_asynch_end(meta_io_req, ret);
return ret;
}
ocf_dobj_submit_io(io);
@@ -193,9 +200,9 @@ static int ocf_restart_meta_io(struct ocf_request *req)
/*
* Iterative asynchronous write callback
*/
static void metadata_io_write_i_end_asynch(void *private_data, int error)
static void metadata_io_write_i_asynch_end(struct metadata_io_request *request,
int error)
{
struct metadata_io_request *request = (private_data);
struct metadata_io_request_asynch *a_req;
struct ocf_cache *cache;
@@ -359,8 +366,8 @@ int metadata_io_write_i_asynch(struct ocf_cache *cache, uint32_t queue,
PAGES_TO_BYTES(a_req->reqs[i].count),
OCF_WRITE, 0, 0);
ocf_io_set_default_cmpl(io, &a_req->reqs[i],
metadata_io_write_i_end_asynch);
ocf_io_set_cmpl(io, &a_req->reqs[i], NULL,
metadata_io_write_i_asynch_cmpl);
error = ocf_io_set_data(io, a_req->reqs[i].data, 0);
if (error) {
ocf_io_put(io);

View File

@@ -306,7 +306,7 @@ static void _raw_ram_flush_mark(struct ocf_cache *cache,
struct _raw_ram_flush_ctx {
struct ocf_metadata_raw *raw;
struct ocf_request *rq;
ocf_metadata_asynch_flush_hndl complete;
ocf_req_end_t complete;
env_atomic flush_req_cnt;
int error;
};
@@ -402,7 +402,7 @@ static void __raw_ram_flush_do_asynch_add_pages(struct ocf_request *rq,
static int _raw_ram_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, struct ocf_metadata_raw *raw,
ocf_end_t complete)
ocf_req_end_t complete)
{
int result = 0, i;
uint32_t __pages_tab[MAX_STACK_TAB_SIZE];

View File

@@ -136,7 +136,7 @@ struct raw_iface {
int (*flush_do_asynch)(struct ocf_cache *cache, struct ocf_request *rq,
struct ocf_metadata_raw *raw,
ocf_metadata_asynch_flush_hndl complete);
ocf_req_end_t complete);
};
/**
@@ -316,7 +316,7 @@ static inline void ocf_metadata_raw_flush_mark(struct ocf_cache *cache,
static inline int ocf_metadata_raw_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, struct ocf_metadata_raw *raw,
ocf_metadata_asynch_flush_hndl complete)
ocf_req_end_t complete)
{
return raw->iface->flush_do_asynch(cache, rq, raw, complete);
}

View File

@@ -33,7 +33,7 @@
struct _raw_atomic_flush_ctx {
struct ocf_request *rq;
ocf_metadata_asynch_flush_hndl complete;
ocf_req_end_t complete;
env_atomic flush_req_cnt;
};
@@ -135,9 +135,8 @@ static int _raw_atomic_flush_do_asynch_sec(struct ocf_cache *cache,
return result;
}
int raw_atomic_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, struct ocf_metadata_raw *raw,
ocf_end_t complete)
int raw_atomic_flush_do_asynch(struct ocf_cache *cache, struct ocf_request *rq,
struct ocf_metadata_raw *raw, ocf_req_end_t complete)
{
int result = 0, i;
uint32_t __clines_tab[MAX_STACK_TAB_SIZE];

View File

@@ -9,8 +9,7 @@
void raw_atomic_flush_mark(struct ocf_cache *cache, struct ocf_request *rq,
uint32_t map_idx, int to_state, uint8_t start, uint8_t stop);
int raw_atomic_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, struct ocf_metadata_raw *raw,
ocf_end_t complete);
int raw_atomic_flush_do_asynch(struct ocf_cache *cache, struct ocf_request *rq,
struct ocf_metadata_raw *raw, ocf_req_end_t complete);
#endif /* __METADATA_RAW_ATOMIC_H__ */
#endif /* __METADATA_RAW_ATOMIC_H__ */

View File

@@ -437,9 +437,8 @@ void raw_dynamic_flush_mark(struct ocf_cache *cache, struct ocf_request *rq,
/*
* RAM DYNAMIC Implementation - Do flushing asynchronously
*/
int raw_dynamic_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, struct ocf_metadata_raw *raw,
ocf_end_t complete)
int raw_dynamic_flush_do_asynch(struct ocf_cache *cache, struct ocf_request *rq,
struct ocf_metadata_raw *raw, ocf_req_end_t complete)
{
ENV_BUG();
return -ENOSYS;

View File

@@ -98,9 +98,8 @@ void raw_dynamic_flush_mark(struct ocf_cache *cache, struct ocf_request *rq,
/*
* DYNAMIC Implementation - Do Flush Asynchronously
*/
int raw_dynamic_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, struct ocf_metadata_raw *raw,
ocf_end_t complete);
int raw_dynamic_flush_do_asynch(struct ocf_cache *cache, struct ocf_request *rq,
struct ocf_metadata_raw *raw, ocf_req_end_t complete);
#endif /* METADATA_RAW_H_ */

View File

@@ -67,7 +67,7 @@ void raw_volatile_flush_mark(struct ocf_cache *cache, struct ocf_request *rq,
*/
int raw_volatile_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, struct ocf_metadata_raw *raw,
ocf_end_t complete)
ocf_req_end_t complete)
{
complete(rq, 0);
return 0;

View File

@@ -47,6 +47,6 @@ void raw_volatile_flush_mark(struct ocf_cache *cache, struct ocf_request *rq,
*/
int raw_volatile_flush_do_asynch(struct ocf_cache *cache,
struct ocf_request *rq, struct ocf_metadata_raw *raw,
ocf_end_t complete);
ocf_req_end_t complete);
#endif /* __METADATA_RAW_VOLATILE_H__ */

View File

@@ -24,19 +24,6 @@ enum ocf_metadata_shutdown_status {
ocf_metadata_detached = 2, /*!< Cache device detached */
};
/**
* @brief Asynchronous metadata request completed
*
* @param cache - Cache instance
* @param error - Indicates operation result, 0 - Finished successfully
* @param line - cache line for which completion is signaled
* @param context - Context of metadata request
*/
typedef void (*ocf_metadata_asynch_hndl)(struct ocf_cache *cache,
int error, ocf_cache_line_t line, void *context);
typedef void (*ocf_metadata_asynch_flush_hndl)(void *context, int error);
/*
* Metadata cache line location on pages interface
*/
@@ -222,7 +209,7 @@ struct ocf_metadata_iface {
* @param context - context that will be passed into callback
*/
void (*flush_do_asynch)(struct ocf_cache *cache,
struct ocf_request *rq, ocf_end_t complete);
struct ocf_request *rq, ocf_req_end_t complete);
/* TODO Provide documentation below */