Extend lru list API
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
5ca1404f06
commit
800190153b
@ -194,7 +194,7 @@ static void remove_lru_list_nobalance(ocf_cache_t cache,
|
|||||||
node->hot = false;
|
node->hot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remove_lru_list(ocf_cache_t cache, struct ocf_lru_list *list,
|
void ocf_lru_remove_locked(ocf_cache_t cache, struct ocf_lru_list *list,
|
||||||
ocf_cache_line_t cline)
|
ocf_cache_line_t cline)
|
||||||
{
|
{
|
||||||
remove_lru_list_nobalance(cache, list, cline);
|
remove_lru_list_nobalance(cache, list, cline);
|
||||||
@ -221,7 +221,7 @@ void ocf_lru_init_cline(ocf_cache_t cache, ocf_cache_line_t cline)
|
|||||||
node->next = end_marker;
|
node->next = end_marker;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ocf_lru_list *ocf_lru_get_list(struct ocf_part *part,
|
struct ocf_lru_list *ocf_lru_get_list(struct ocf_part *part,
|
||||||
uint32_t lru_idx, bool clean)
|
uint32_t lru_idx, bool clean)
|
||||||
{
|
{
|
||||||
if (part->id == PARTITION_FREELIST)
|
if (part->id == PARTITION_FREELIST)
|
||||||
@ -257,7 +257,7 @@ void ocf_lru_add(ocf_cache_t cache, ocf_cache_line_t cline)
|
|||||||
static inline void ocf_lru_move(ocf_cache_t cache, ocf_cache_line_t cline,
|
static inline void ocf_lru_move(ocf_cache_t cache, ocf_cache_line_t cline,
|
||||||
struct ocf_lru_list *src_list, struct ocf_lru_list *dst_list)
|
struct ocf_lru_list *src_list, struct ocf_lru_list *dst_list)
|
||||||
{
|
{
|
||||||
remove_lru_list(cache, src_list, cline);
|
ocf_lru_remove_locked(cache, src_list, cline);
|
||||||
add_lru_head(cache, dst_list, cline);
|
add_lru_head(cache, dst_list, cline);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,7 +846,7 @@ void ocf_lru_clean_cline(ocf_cache_t cache, struct ocf_part *part,
|
|||||||
dirty_list = ocf_lru_get_list(part, lru_list, false);
|
dirty_list = ocf_lru_get_list(part, lru_list, false);
|
||||||
|
|
||||||
OCF_METADATA_LRU_WR_LOCK(cline);
|
OCF_METADATA_LRU_WR_LOCK(cline);
|
||||||
remove_lru_list(cache, dirty_list, cline);
|
ocf_lru_remove_locked(cache, dirty_list, cline);
|
||||||
add_lru_head(cache, clean_list, cline);
|
add_lru_head(cache, clean_list, cline);
|
||||||
OCF_METADATA_LRU_WR_UNLOCK(cline);
|
OCF_METADATA_LRU_WR_UNLOCK(cline);
|
||||||
}
|
}
|
||||||
@ -862,7 +862,7 @@ void ocf_lru_dirty_cline(ocf_cache_t cache, struct ocf_part *part,
|
|||||||
dirty_list = ocf_lru_get_list(part, lru_list, false);
|
dirty_list = ocf_lru_get_list(part, lru_list, false);
|
||||||
|
|
||||||
OCF_METADATA_LRU_WR_LOCK(cline);
|
OCF_METADATA_LRU_WR_LOCK(cline);
|
||||||
remove_lru_list(cache, clean_list, cline);
|
ocf_lru_remove_locked(cache, clean_list, cline);
|
||||||
add_lru_head(cache, dirty_list, cline);
|
add_lru_head(cache, dirty_list, cline);
|
||||||
OCF_METADATA_LRU_WR_UNLOCK(cline);
|
OCF_METADATA_LRU_WR_UNLOCK(cline);
|
||||||
}
|
}
|
||||||
|
@ -32,5 +32,9 @@ void ocf_lru_repart(ocf_cache_t cache, ocf_cache_line_t cline,
|
|||||||
struct ocf_part *src_upart, struct ocf_part *dst_upart);
|
struct ocf_part *src_upart, struct ocf_part *dst_upart);
|
||||||
uint32_t ocf_lru_num_free(ocf_cache_t cache);
|
uint32_t ocf_lru_num_free(ocf_cache_t cache);
|
||||||
void ocf_lru_populate(ocf_cache_t cache, ocf_cache_line_t num_free_clines);
|
void ocf_lru_populate(ocf_cache_t cache, ocf_cache_line_t num_free_clines);
|
||||||
|
struct ocf_lru_list *ocf_lru_get_list(struct ocf_part *part,
|
||||||
|
uint32_t lru_idx, bool clean);
|
||||||
|
void ocf_lru_remove_locked(ocf_cache_t cache, struct ocf_lru_list *list,
|
||||||
|
ocf_cache_line_t cline);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user