Single map alloc location
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
This commit is contained in:
parent
af1f3d73c2
commit
bd7a89c819
@ -144,11 +144,6 @@ struct ocf_request *ocf_engine_pop_req(ocf_queue_t q)
|
||||
|
||||
OCF_CHECK_NULL(req);
|
||||
|
||||
if (ocf_req_alloc_map(req)) {
|
||||
req->complete(req, req->error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
|
@ -227,23 +227,16 @@ static int ocf_core_submit_io_fast(struct ocf_io *io, struct ocf_request *req,
|
||||
struct ocf_event_io trace_event;
|
||||
ocf_req_cache_mode_t original_cache_mode;
|
||||
int fast;
|
||||
int ret;
|
||||
|
||||
if (req->d2c) {
|
||||
return -OCF_ERR_IO;
|
||||
}
|
||||
|
||||
ret = ocf_req_alloc_map(req);
|
||||
if (ret) {
|
||||
return -OCF_ERR_IO;
|
||||
}
|
||||
|
||||
original_cache_mode = req->cache_mode;
|
||||
|
||||
switch (req->cache_mode) {
|
||||
case ocf_req_cache_mode_pt:
|
||||
ret = -OCF_ERR_IO;
|
||||
goto map_allocated;
|
||||
return -OCF_ERR_IO;
|
||||
case ocf_req_cache_mode_wb:
|
||||
case ocf_req_cache_mode_wo:
|
||||
req->cache_mode = ocf_req_cache_mode_fast;
|
||||
@ -253,10 +246,7 @@ static int ocf_core_submit_io_fast(struct ocf_io *io, struct ocf_request *req,
|
||||
break;
|
||||
|
||||
if (io->dir == OCF_WRITE)
|
||||
{
|
||||
ret = -OCF_ERR_IO;
|
||||
goto map_allocated;
|
||||
}
|
||||
return -OCF_ERR_IO;
|
||||
|
||||
req->cache_mode = ocf_req_cache_mode_fast;
|
||||
}
|
||||
@ -275,10 +265,7 @@ static int ocf_core_submit_io_fast(struct ocf_io *io, struct ocf_request *req,
|
||||
}
|
||||
|
||||
req->cache_mode = original_cache_mode;
|
||||
ret = -OCF_ERR_IO;
|
||||
map_allocated:
|
||||
ocf_req_dealloc_map(req);
|
||||
return ret;
|
||||
return -OCF_ERR_IO;
|
||||
}
|
||||
|
||||
void ocf_core_volume_submit_io(struct ocf_io *io)
|
||||
@ -308,6 +295,12 @@ void ocf_core_volume_submit_io(struct ocf_io *io)
|
||||
return;
|
||||
}
|
||||
|
||||
ret = ocf_req_alloc_map(req);
|
||||
if (ret) {
|
||||
ocf_io_end(io, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
req->part_id = ocf_user_part_class2id(cache, io->io_class);
|
||||
req->core = core;
|
||||
req->complete = ocf_req_complete;
|
||||
@ -323,6 +316,7 @@ void ocf_core_volume_submit_io(struct ocf_io *io)
|
||||
return;
|
||||
}
|
||||
|
||||
ocf_req_clear_map(req);
|
||||
ocf_core_seq_cutoff_update(core, req);
|
||||
|
||||
if (io->dir == OCF_WRITE)
|
||||
|
@ -153,15 +153,6 @@ int ocf_req_alloc_map(struct ocf_request *req)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ocf_req_dealloc_map(struct ocf_request *req)
|
||||
{
|
||||
if (req->map && req->map != req->__map)
|
||||
{
|
||||
env_free(req->map);
|
||||
req->map = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int ocf_req_alloc_map_discard(struct ocf_request *req)
|
||||
{
|
||||
ENV_BUILD_BUG_ON(MAX_TRIM_RQ_SIZE / ocf_cache_line_size_4 *
|
||||
|
@ -271,13 +271,6 @@ struct ocf_request *ocf_req_new(ocf_queue_t queue, ocf_core_t core,
|
||||
*/
|
||||
int ocf_req_alloc_map(struct ocf_request *req);
|
||||
|
||||
/**
|
||||
* @brief Deallocate OCF request map, if it wasn't allocated from mpool
|
||||
*
|
||||
* @param req OCF request
|
||||
*/
|
||||
void ocf_req_dealloc_map(struct ocf_request *req);
|
||||
|
||||
/**
|
||||
* @brief Allocate OCF request map for discard request
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user