Separate engine map/evict (refactoring)
This temporarily increases amount of boiler-plate code, but this is going to be mitigated in the following commits. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
#include "../utils/utils_cleaner.h"
|
||||
#include "../metadata/metadata.h"
|
||||
#include "../eviction/eviction.h"
|
||||
#include "../promotion/promotion.h"
|
||||
|
||||
void ocf_engine_error(struct ocf_request *req,
|
||||
bool stop_cache, const char *msg)
|
||||
@@ -315,18 +314,15 @@ void ocf_engine_map(struct ocf_request *req)
|
||||
int status = LOOKUP_MAPPED;
|
||||
ocf_core_id_t core_id = ocf_core_get_id(req->core);
|
||||
|
||||
if (!ocf_promotion_req_should_promote(cache->promotion_policy, req)) {
|
||||
if (!ocf_engine_unmapped_count(req))
|
||||
return;
|
||||
|
||||
if (ocf_engine_unmapped_count(req) >
|
||||
ocf_freelist_num_free(cache->freelist)) {
|
||||
req->info.mapping_error = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ocf_engine_unmapped_count(req))
|
||||
status = space_managment_evict_do(cache, req,
|
||||
ocf_engine_unmapped_count(req));
|
||||
|
||||
if (req->info.mapping_error)
|
||||
return;
|
||||
|
||||
ocf_req_clear_info(req);
|
||||
req->info.seq_req = true;
|
||||
|
||||
@@ -397,6 +393,15 @@ static void _ocf_engine_clean_end(void *private_data, int error)
|
||||
}
|
||||
}
|
||||
|
||||
int ocf_engine_evict(struct ocf_request *req)
|
||||
{
|
||||
if (!ocf_engine_unmapped_count(req))
|
||||
return 0;
|
||||
|
||||
return space_managment_evict_do(req->cache, req,
|
||||
ocf_engine_unmapped_count(req));
|
||||
}
|
||||
|
||||
static int _ocf_engine_clean_getter(struct ocf_cache *cache,
|
||||
void *getter_context, uint32_t item, ocf_cache_line_t *line)
|
||||
{
|
||||
|
Reference in New Issue
Block a user