Enable particular ioclass eviction
If partition's occupancy limit is reached, cachelines should be evicted from request's target partition. Information whether particular partition eviction should be triggered is carried as a flag by request which triggered eviction. Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
e9d7290078
commit
718dc743c8
@ -40,6 +40,22 @@ static uint32_t ocf_evict_calculate(struct ocf_user_part *part,
|
||||
return to_evict;
|
||||
}
|
||||
|
||||
static inline uint32_t ocf_evict_part_do(ocf_cache_t cache,
|
||||
ocf_queue_t io_queue, const uint32_t evict_cline_no,
|
||||
struct ocf_user_part *target_part)
|
||||
{
|
||||
uint32_t to_evict = 0;
|
||||
|
||||
if (!evp_lru_can_evict(cache))
|
||||
return 0;
|
||||
|
||||
to_evict = ocf_evict_calculate(&cache->user_parts[target_part_id],
|
||||
evict_cline_no);
|
||||
|
||||
return ocf_eviction_need_space(cache, io_queue,
|
||||
target_part, to_evict);
|
||||
}
|
||||
|
||||
static inline uint32_t ocf_evict_do(ocf_cache_t cache,
|
||||
ocf_queue_t io_queue, const uint32_t evict_cline_no,
|
||||
struct ocf_user_part *target_part)
|
||||
@ -109,12 +125,18 @@ int space_managment_evict_do(struct ocf_cache *cache,
|
||||
uint32_t free;
|
||||
struct ocf_user_part *req_part = &cache->user_parts[req->part_id];
|
||||
|
||||
if (ocf_req_part_evict(req)) {
|
||||
evicted = ocf_evict_part_do(cache, req->io_queue, evict_cline_no,
|
||||
req_part);
|
||||
} else {
|
||||
free = ocf_freelist_num_free(cache->freelist);
|
||||
if (evict_cline_no <= free)
|
||||
return LOOKUP_MAPPED;
|
||||
|
||||
evict_cline_no -= free;
|
||||
|
||||
evicted = ocf_evict_do(cache, req->io_queue, evict_cline_no, req_part);
|
||||
}
|
||||
|
||||
if (evict_cline_no <= evicted)
|
||||
return LOOKUP_MAPPED;
|
||||
|
@ -191,6 +191,9 @@ struct ocf_request {
|
||||
uint8_t wi_second_pass : 1;
|
||||
/*!< Set after first pass of WI write is completed */
|
||||
|
||||
uint8_t part_evict : 1;
|
||||
/* !< Some cachelines from request's partition must be evicted */
|
||||
|
||||
log_sid_t sid;
|
||||
/*!< Tracing sequence ID */
|
||||
|
||||
@ -332,6 +335,40 @@ void ocf_req_clear_map(struct ocf_request *req);
|
||||
*/
|
||||
void ocf_req_hash(struct ocf_request *req);
|
||||
|
||||
/**
|
||||
* @brief Request should trigger eviction from it's target partition
|
||||
*
|
||||
* @param req - OCF request
|
||||
*/
|
||||
static inline void ocf_req_set_part_evict(struct ocf_request *req)
|
||||
{
|
||||
req->part_evict = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Request shouldn't trigger eviction from it's target partition
|
||||
*
|
||||
* @param req - OCF request
|
||||
*/
|
||||
static inline void ocf_req_clear_part_evict(struct ocf_request *req)
|
||||
{
|
||||
req->part_evict = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check wheter request shouldn't trigger eviction from it's target
|
||||
* partition or any partition
|
||||
*
|
||||
* @param req - OCF request
|
||||
* @return true - Eviciton should be triggered from request's target partition
|
||||
* @return false - Eviction should be triggered with respect to eviction
|
||||
* priority
|
||||
*/
|
||||
static inline bool ocf_req_part_evict(struct ocf_request *req)
|
||||
{
|
||||
return req->part_evict;
|
||||
}
|
||||
|
||||
int ocf_req_set_dirty(struct ocf_request *req);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user