Rename "evict" to "remap" across the entire repo
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
@@ -385,21 +385,21 @@ static void _ocf_engine_clean_end(void *private_data, int error)
|
||||
}
|
||||
}
|
||||
|
||||
static void ocf_engine_evict(struct ocf_request *req)
|
||||
static void ocf_engine_remap(struct ocf_request *req)
|
||||
{
|
||||
int status;
|
||||
|
||||
status = space_managment_evict_do(req);
|
||||
status = ocf_space_managment_remap_do(req);
|
||||
if (status == LOOKUP_MISS) {
|
||||
/* mark error */
|
||||
ocf_req_set_mapping_error(req);
|
||||
|
||||
/* unlock cachelines locked during eviction */
|
||||
/* unlock cachelines locked during remapping */
|
||||
ocf_req_unlock(ocf_cache_line_concurrency(req->cache),
|
||||
req);
|
||||
|
||||
/* request cleaning */
|
||||
ocf_req_set_clean_eviction(req);
|
||||
ocf_req_set_cleaning_required(req);
|
||||
|
||||
/* unmap inserted and replaced cachelines */
|
||||
ocf_engine_map_hndl_error(req->cache, req);
|
||||
@@ -439,7 +439,7 @@ static inline void ocf_prepare_clines_miss(struct ocf_request *req)
|
||||
ocf_req_clear_part_evict(req);
|
||||
}
|
||||
|
||||
ocf_engine_evict(req);
|
||||
ocf_engine_remap(req);
|
||||
|
||||
if (!ocf_req_test_mapping_error(req))
|
||||
ocf_promotion_req_purge(req->cache->promotion_policy, req);
|
||||
@@ -517,8 +517,8 @@ int ocf_engine_prepare_clines(struct ocf_request *req)
|
||||
|
||||
ocf_hb_req_prot_unlock_wr(req);
|
||||
|
||||
if (ocf_req_test_clean_eviction(req)) {
|
||||
ocf_eviction_flush_dirty(req->cache, user_part, req->io_queue,
|
||||
if (ocf_req_is_cleaning_required(req)) {
|
||||
ocf_lru_flush_dirty(req->cache, user_part, req->io_queue,
|
||||
128);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,8 @@ static inline uint32_t ocf_evict_part_do(struct ocf_request *req,
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ocf_eviction_need_space(req->cache, req, &user_part->part, to_evict);
|
||||
return ocf_request_space(req->cache, req, &user_part->part,
|
||||
to_evict);
|
||||
}
|
||||
|
||||
static inline uint32_t ocf_evict_user_partitions(ocf_cache_t cache,
|
||||
@@ -110,8 +111,8 @@ static inline uint32_t ocf_evict_user_partitions(ocf_cache_t cache,
|
||||
if (overflown_only)
|
||||
to_evict = OCF_MIN(to_evict, overflow_size);
|
||||
|
||||
evicted += ocf_eviction_need_space(cache, req,
|
||||
&user_part->part, to_evict);
|
||||
evicted += ocf_request_space(cache, req, &user_part->part,
|
||||
to_evict);
|
||||
|
||||
if (evicted >= evict_cline_no) {
|
||||
/* Evicted requested number of cache line, stop
|
||||
@@ -125,55 +126,55 @@ out:
|
||||
return evicted;
|
||||
}
|
||||
|
||||
static inline uint32_t ocf_evict_do(struct ocf_request *req)
|
||||
static inline uint32_t ocf_remap_do(struct ocf_request *req)
|
||||
{
|
||||
ocf_cache_t cache = req->cache;
|
||||
ocf_part_id_t target_part_id = req->part_id;
|
||||
struct ocf_user_part *target_part = &cache->user_parts[target_part_id];
|
||||
uint32_t evict_cline_no = ocf_engine_unmapped_count(req);
|
||||
uint32_t evicted = 0;
|
||||
uint32_t remap_cline_no = ocf_engine_unmapped_count(req);
|
||||
uint32_t remapped = 0;
|
||||
|
||||
/* First attempt to map from freelist */
|
||||
if (ocf_lru_num_free(cache) > 0) {
|
||||
evicted = ocf_eviction_need_space(cache, req, &cache->free,
|
||||
evict_cline_no);
|
||||
remapped = ocf_request_space(cache, req, &cache->free,
|
||||
remap_cline_no);
|
||||
}
|
||||
if (evicted >= evict_cline_no)
|
||||
return evicted;
|
||||
if (remapped >= remap_cline_no)
|
||||
return remapped;
|
||||
|
||||
/* Attempt to evict overflown partitions in order to
|
||||
* achieve configured maximum size. Ignoring partitions
|
||||
* priority in this case, as overflown partitions should
|
||||
* free its cachelines regardless of destination partition
|
||||
* priority. */
|
||||
evicted += ocf_evict_user_partitions(cache, req, evict_cline_no,
|
||||
remapped += ocf_evict_user_partitions(cache, req, remap_cline_no,
|
||||
true, OCF_IO_CLASS_PRIO_PINNED);
|
||||
if (evicted >= evict_cline_no)
|
||||
return evicted;
|
||||
if (remapped >= remap_cline_no)
|
||||
return remapped;
|
||||
|
||||
/* Not enough cachelines in overflown partitions. Go through
|
||||
* partitions with priority <= target partition and attempt
|
||||
* to evict from those. */
|
||||
evict_cline_no -= evicted;
|
||||
evicted += ocf_evict_user_partitions(cache, req, evict_cline_no,
|
||||
remap_cline_no -= remapped;
|
||||
remapped += ocf_evict_user_partitions(cache, req, remap_cline_no,
|
||||
false, target_part->config->priority);
|
||||
|
||||
return evicted;
|
||||
return remapped;
|
||||
}
|
||||
|
||||
int space_managment_evict_do(struct ocf_request *req)
|
||||
int ocf_space_managment_remap_do(struct ocf_request *req)
|
||||
{
|
||||
uint32_t needed = ocf_engine_unmapped_count(req);
|
||||
uint32_t evicted;
|
||||
uint32_t remapped;
|
||||
struct ocf_user_part *req_part = &req->cache->user_parts[req->part_id];
|
||||
|
||||
if (ocf_req_part_evict(req)) {
|
||||
evicted = ocf_evict_part_do(req, req_part);
|
||||
remapped = ocf_evict_part_do(req, req_part);
|
||||
} else {
|
||||
evicted = ocf_evict_do(req);
|
||||
remapped = ocf_remap_do(req);
|
||||
}
|
||||
|
||||
if (needed <= evicted)
|
||||
if (needed <= remapped)
|
||||
return LOOKUP_REMAPPED;
|
||||
|
||||
return LOOKUP_MISS;
|
||||
|
||||
@@ -64,7 +64,7 @@ extern struct eviction_policy_ops evict_policy_ops[ocf_eviction_max];
|
||||
* 'LOOKUP_HIT' if evicted enough cachelines to serve @req
|
||||
* 'LOOKUP_MISS' otherwise
|
||||
*/
|
||||
int space_managment_evict_do(struct ocf_request *req);
|
||||
int ocf_space_managment_remap_do(struct ocf_request *req);
|
||||
|
||||
int space_management_free(ocf_cache_t cache, uint32_t count);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ static inline bool ocf_eviction_can_evict(struct ocf_cache *cache)
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline uint32_t ocf_eviction_need_space(ocf_cache_t cache,
|
||||
static inline uint32_t ocf_request_space(ocf_cache_t cache,
|
||||
struct ocf_request *req, struct ocf_part *part,
|
||||
uint32_t clines)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ static inline void ocf_eviction_initialize(struct ocf_cache *cache,
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ocf_eviction_flush_dirty(ocf_cache_t cache,
|
||||
static inline void ocf_lru_flush_dirty(ocf_cache_t cache,
|
||||
struct ocf_user_part *user_part, ocf_queue_t io_queue,
|
||||
uint32_t count)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ struct ocf_req_info {
|
||||
uint32_t mapping_error : 1;
|
||||
/*!< Core lines in this request were not mapped into cache */
|
||||
|
||||
uint32_t clean_eviction : 1;
|
||||
uint32_t cleaning_required : 1;
|
||||
/*!< Eviction failed, need to request cleaning */
|
||||
|
||||
uint32_t core_error : 1;
|
||||
@@ -403,14 +403,14 @@ static inline bool ocf_req_test_mapping_error(struct ocf_request *req)
|
||||
return req->info.mapping_error;
|
||||
}
|
||||
|
||||
static inline void ocf_req_set_clean_eviction(struct ocf_request *req)
|
||||
static inline void ocf_req_set_cleaning_required(struct ocf_request *req)
|
||||
{
|
||||
req->info.clean_eviction = true;
|
||||
req->info.cleaning_required = true;
|
||||
}
|
||||
|
||||
static inline bool ocf_req_test_clean_eviction(struct ocf_request *req)
|
||||
static inline bool ocf_req_is_cleaning_required(struct ocf_request *req)
|
||||
{
|
||||
return req->info.clean_eviction;
|
||||
return req->info.cleaning_required;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user