Move and rename ocf_engine_pop_req from cache_engine to ocf_queue_pop_req in ocf_queue
Signed-off-by: Ian Levine <ian.levine@huawei.com> Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
This commit is contained in:
parent
038126e9ab
commit
4f2d5c22d6
@ -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];
|
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)
|
bool ocf_fallback_pt_is_on(ocf_cache_t cache)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(env_atomic_read(&cache->fallback_pt_error_counter) < 0);
|
ENV_BUG_ON(env_atomic_read(&cache->fallback_pt_error_counter) < 0);
|
||||||
|
@ -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);
|
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);
|
int ocf_engine_hndl_req(struct ocf_request *req);
|
||||||
|
|
||||||
#define OCF_FAST_PATH_YES 7
|
#define OCF_FAST_PATH_YES 7
|
||||||
|
@ -89,13 +89,44 @@ void ocf_io_handle(struct ocf_io *io, void *opaque)
|
|||||||
req->engine_handler(req);
|
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)
|
void ocf_queue_run_single(ocf_queue_t q)
|
||||||
{
|
{
|
||||||
struct ocf_request *io_req = NULL;
|
struct ocf_request *io_req = NULL;
|
||||||
|
|
||||||
OCF_CHECK_NULL(q);
|
OCF_CHECK_NULL(q);
|
||||||
|
|
||||||
io_req = ocf_engine_pop_req(q);
|
io_req = ocf_queue_pop_req(q);
|
||||||
|
|
||||||
if (!io_req)
|
if (!io_req)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user