Added a priority queue for the request instead of push front
Now the request can be pushed to a high priority queue (instead of ocf_queue_push_req_front) and to a low priority queue (instead of ocf_queue_push_req_back). Both functions were merged into one function (ocf_queue_push_req) and instead of the allow_sync parameter there is now a flags parameter that can be an OR combination of OCF_QUEUE_ALLOW_SYNC and OCF_QUEUE_PRIO_HIGH Signed-off-by: Ian Levine <ian.levine@huawei.com> Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
This commit is contained in:

committed by
Robert Baldyga

parent
4f2d5c22d6
commit
ac1b6b774a
@@ -217,8 +217,8 @@ static void _ocf_cleaner_complete_req(struct ocf_request *req)
|
||||
|
||||
if (master->complete_queue) {
|
||||
ocf_req_get(master);
|
||||
ocf_queue_push_req_front_cb(master,
|
||||
_ocf_cleaner_complete, true);
|
||||
ocf_queue_push_req_cb(master, _ocf_cleaner_complete,
|
||||
OCF_QUEUE_ALLOW_SYNC | OCF_QUEUE_PRIO_HIGH);
|
||||
} else {
|
||||
/* Only master contains completion function and priv */
|
||||
cmpl = master->master_io_req;
|
||||
@@ -232,7 +232,7 @@ static void _ocf_cleaner_complete_req(struct ocf_request *req)
|
||||
static void _ocf_cleaner_on_resume(struct ocf_request *req)
|
||||
{
|
||||
OCF_DEBUG_TRACE(req->cache);
|
||||
ocf_queue_push_req_front(req, true);
|
||||
ocf_queue_push_req(req, OCF_QUEUE_ALLOW_SYNC | OCF_QUEUE_PRIO_HIGH);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -336,7 +336,7 @@ static void _ocf_cleaner_metadata_io_end(struct ocf_request *req, int error)
|
||||
OCF_DEBUG_MSG(req->cache, "Metadata flush finished");
|
||||
|
||||
req->engine_handler = _ocf_cleaner_fire_flush_cache;
|
||||
ocf_queue_push_req_front(req, true);
|
||||
ocf_queue_push_req(req, OCF_QUEUE_ALLOW_SYNC | OCF_QUEUE_PRIO_HIGH);
|
||||
}
|
||||
|
||||
static int _ocf_cleaner_update_metadata(struct ocf_request *req)
|
||||
@@ -415,7 +415,7 @@ static void _ocf_cleaner_flush_cores_io_end(struct ocf_map_info *map,
|
||||
* All core writes done, switch to post cleaning activities
|
||||
*/
|
||||
req->engine_handler = _ocf_cleaner_update_metadata;
|
||||
ocf_queue_push_req_front(req, true);
|
||||
ocf_queue_push_req(req, OCF_QUEUE_ALLOW_SYNC | OCF_QUEUE_PRIO_HIGH);
|
||||
}
|
||||
|
||||
static void _ocf_cleaner_flush_cores_io_cmpl(struct ocf_io *io, int error)
|
||||
@@ -487,7 +487,7 @@ static void _ocf_cleaner_core_io_end(struct ocf_request *req)
|
||||
* Move processing to thread, where IO will be (and can be) submitted
|
||||
*/
|
||||
req->engine_handler = _ocf_cleaner_fire_flush_cores;
|
||||
ocf_queue_push_req_front(req, true);
|
||||
ocf_queue_push_req(req, OCF_QUEUE_ALLOW_SYNC | OCF_QUEUE_PRIO_HIGH);
|
||||
}
|
||||
|
||||
static void _ocf_cleaner_core_io_cmpl(struct ocf_io *io, int error)
|
||||
@@ -645,7 +645,7 @@ static void _ocf_cleaner_cache_io_end(struct ocf_request *req)
|
||||
* Move processing to thread, where IO will be (and can be) submitted
|
||||
*/
|
||||
req->engine_handler = _ocf_cleaner_fire_core;
|
||||
ocf_queue_push_req_front(req, true);
|
||||
ocf_queue_push_req(req, OCF_QUEUE_ALLOW_SYNC | OCF_QUEUE_PRIO_HIGH);
|
||||
|
||||
OCF_DEBUG_MSG(req->cache, "Cache reads finished");
|
||||
}
|
||||
|
@@ -142,5 +142,5 @@ void ocf_parallelize_run(ocf_parallelize_t parallelize)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < parallelize->shards_cnt; i++)
|
||||
ocf_queue_push_req_front(parallelize->reqs[i], false);
|
||||
ocf_queue_push_req(parallelize->reqs[i], OCF_QUEUE_PRIO_HIGH);
|
||||
}
|
||||
|
@@ -126,12 +126,12 @@ void *ocf_pipeline_get_priv(ocf_pipeline_t pipeline)
|
||||
|
||||
void ocf_pipeline_next(ocf_pipeline_t pipeline)
|
||||
{
|
||||
ocf_queue_push_req_front(pipeline->req, false);
|
||||
ocf_queue_push_req(pipeline->req, OCF_QUEUE_PRIO_HIGH);
|
||||
}
|
||||
|
||||
void ocf_pipeline_finish(ocf_pipeline_t pipeline, int error)
|
||||
{
|
||||
pipeline->finish = true;
|
||||
pipeline->error = error;
|
||||
ocf_queue_push_req_front(pipeline->req, false);
|
||||
ocf_queue_push_req(pipeline->req, OCF_QUEUE_PRIO_HIGH);
|
||||
}
|
||||
|
Reference in New Issue
Block a user