From 962f9d17d1771215551a23d00e23fcadfdf783c1 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Fri, 19 Apr 2019 12:12:20 -0400 Subject: [PATCH] Remove functions to wait for cache pending requests Signed-off-by: Adam Rutkowski --- inc/ocf_cache.h | 14 -------------- src/ocf_cache.c | 20 -------------------- src/ocf_cache_priv.h | 2 -- src/utils/utils_req.c | 11 ----------- src/utils/utils_req.h | 9 --------- 5 files changed, 56 deletions(-) diff --git a/inc/ocf_cache.h b/inc/ocf_cache.h index f6388e2..efd6ea1 100644 --- a/inc/ocf_cache.h +++ b/inc/ocf_cache.h @@ -160,20 +160,6 @@ bool ocf_cache_is_device_attached(ocf_cache_t cache); */ bool ocf_cache_is_running(ocf_cache_t cache); -/** - * @brief Wait for all IO to finish - * - * @param[in] cache Cache object - */ -void ocf_cache_wait_for_io_finish(ocf_cache_t cache); - -/** - * @brief Check if cache has any unfunished requests - * - * @param[in] cache Cache object - */ -bool ocf_cache_has_pending_requests(ocf_cache_t cache); - /** * @brief Check if cleaning triggered by eviction runs on the cache * diff --git a/src/ocf_cache.c b/src/ocf_cache.c index ffc7c86..eadf234 100644 --- a/src/ocf_cache.c +++ b/src/ocf_cache.c @@ -53,26 +53,6 @@ bool ocf_cache_is_device_attached(ocf_cache_t cache) return !ocf_refcnt_frozen(&cache->refcnt.metadata); } -void ocf_cache_wait_for_io_finish(ocf_cache_t cache) -{ - uint32_t req_active = 0; - - OCF_CHECK_NULL(cache); - - do { - req_active = ocf_req_get_allocated(cache); - if (req_active) - env_msleep(500); - } while (req_active); -} - -bool ocf_cache_has_pending_requests(ocf_cache_t cache) -{ - OCF_CHECK_NULL(cache); - - return ocf_req_get_allocated(cache) > 0; -} - /* * This is temporary workaround allowing to check if cleaning triggered * by eviction policy is running on the cache. This information is needed diff --git a/src/ocf_cache_priv.h b/src/ocf_cache_priv.h index d9af32d..609c73b 100644 --- a/src/ocf_cache_priv.h +++ b/src/ocf_cache_priv.h @@ -168,8 +168,6 @@ struct ocf_cache { char name[OCF_CACHE_NAME_SIZE]; - env_atomic pending_requests; - struct { struct ocf_refcnt dirty; struct ocf_refcnt metadata; diff --git a/src/utils/utils_req.c b/src/utils/utils_req.c index 11ec35c..7448ea5 100644 --- a/src/utils/utils_req.c +++ b/src/utils/utils_req.c @@ -191,9 +191,6 @@ struct ocf_request *ocf_req_new(ocf_queue_t queue, ocf_core_t core, req->core_id = core ? ocf_core_get_id(core) : 0; req->cache = cache; - if (queue != cache->mngt_queue) - env_atomic_inc(&cache->pending_requests); - req->d2c = (queue != cache->mngt_queue) && !ocf_refcnt_inc( &cache->refcnt.metadata); @@ -278,9 +275,6 @@ void ocf_req_put(struct ocf_request *req) if (!req->d2c && req->io_queue != req->cache->mngt_queue) ocf_refcnt_dec(&req->cache->refcnt.metadata); - if (req->io_queue != req->cache->mngt_queue) - env_atomic_dec(&req->cache->pending_requests); - allocator = _ocf_req_get_allocator(req->cache, req->alloc_core_line_count); if (allocator) { @@ -302,8 +296,3 @@ void ocf_req_clear_map(struct ocf_request *req) ENV_BUG_ON(env_memset(req->map, sizeof(req->map[0]) * req->core_line_count, 0)); } - -uint32_t ocf_req_get_allocated(struct ocf_cache *cache) -{ - return env_atomic_read(&cache->pending_requests); -} diff --git a/src/utils/utils_req.h b/src/utils/utils_req.h index 1d64154..c53b878 100644 --- a/src/utils/utils_req.h +++ b/src/utils/utils_req.h @@ -83,15 +83,6 @@ struct ocf_request *ocf_req_new_extended(ocf_queue_t queue, ocf_core_t core, struct ocf_request *ocf_req_new_discard(ocf_queue_t queue, ocf_core_t core, uint64_t addr, uint32_t bytes, int rw); -/** - * @brief Get number of allocated requests - * - * @param cache OCF cache instance - * - * @return Number of allocated requests - */ -uint32_t ocf_req_get_allocated(struct ocf_cache *cache); - /** * @brief Increment OCF request reference count *