diff --git a/src/engine/cache_engine.c b/src/engine/cache_engine.c index 014ba49..e731a77 100644 --- a/src/engine/cache_engine.c +++ b/src/engine/cache_engine.c @@ -158,37 +158,6 @@ static ocf_req_cb ocf_cache_mode_to_engine_cb( return cache_mode_io_if_map[req_cache_mode]->cbs[rw]; } -struct ocf_request *ocf_engine_pop_req(ocf_queue_t q) -{ - unsigned long lock_flags = 0; - struct ocf_request *req; - - OCF_CHECK_NULL(q); - - /* LOCK */ - env_spinlock_lock_irqsave(&q->io_list_lock, lock_flags); - - if (list_empty(&q->io_list)) { - /* No items on the list */ - env_spinlock_unlock_irqrestore(&q->io_list_lock, - lock_flags); - return NULL; - } - - /* Get the first request and remove it from the list */ - req = list_first_entry(&q->io_list, struct ocf_request, list); - - env_atomic_dec(&q->io_no); - list_del(&req->list); - - /* UNLOCK */ - env_spinlock_unlock_irqrestore(&q->io_list_lock, lock_flags); - - OCF_CHECK_NULL(req); - - return req; -} - bool ocf_fallback_pt_is_on(ocf_cache_t cache) { ENV_BUG_ON(env_atomic_read(&cache->fallback_pt_error_counter) < 0); diff --git a/src/engine/cache_engine.h b/src/engine/cache_engine.h index 88c6da4..bb61e79 100644 --- a/src/engine/cache_engine.h +++ b/src/engine/cache_engine.h @@ -36,8 +36,6 @@ bool ocf_req_cache_mode_has_lazy_write(ocf_req_cache_mode_t mode); bool ocf_fallback_pt_is_on(ocf_cache_t cache); -struct ocf_request *ocf_engine_pop_req(struct ocf_queue *q); - int ocf_engine_hndl_req(struct ocf_request *req); #define OCF_FAST_PATH_YES 7 diff --git a/src/ocf_queue.c b/src/ocf_queue.c index 22ae93e..409b7b0 100644 --- a/src/ocf_queue.c +++ b/src/ocf_queue.c @@ -89,13 +89,44 @@ void ocf_io_handle(struct ocf_io *io, void *opaque) req->engine_handler(req); } +static struct ocf_request *ocf_queue_pop_req(ocf_queue_t q) +{ + unsigned long lock_flags = 0; + struct ocf_request *req; + + OCF_CHECK_NULL(q); + + /* LOCK */ + env_spinlock_lock_irqsave(&q->io_list_lock, lock_flags); + + if (list_empty(&q->io_list)) { + /* No items on the list */ + env_spinlock_unlock_irqrestore(&q->io_list_lock, + lock_flags); + return NULL; + } + + /* Get the first request and remove it from the list */ + req = list_first_entry(&q->io_list, struct ocf_request, list); + + env_atomic_dec(&q->io_no); + list_del(&req->list); + + /* UNLOCK */ + env_spinlock_unlock_irqrestore(&q->io_list_lock, lock_flags); + + OCF_CHECK_NULL(req); + + return req; +} + void ocf_queue_run_single(ocf_queue_t q) { struct ocf_request *io_req = NULL; OCF_CHECK_NULL(q); - io_req = ocf_engine_pop_req(q); + io_req = ocf_queue_pop_req(q); if (!io_req) return;