ftl: cache unmapped translations
This commit is contained in:
parent
f68e26ac12
commit
15d2f6dc4b
2 changed files with 14 additions and 2 deletions
|
@ -32,6 +32,7 @@ struct ftl_map {
|
|||
};
|
||||
|
||||
#define FTL_CACHED_VA BIT(0)
|
||||
#define FTL_UNMAPPED BIT(1)
|
||||
|
||||
#define FTL_MAX_ATTEMPTS 8
|
||||
|
||||
|
|
|
@ -382,8 +382,15 @@ int trace_path(struct ftl_map *map, struct ftl_page_desc *new_page_desc,
|
|||
uint8_t depth = 0;
|
||||
uint32_t upage = map->root;
|
||||
|
||||
if ((map->flags & FTL_CACHED_VA) && map->last_va == va)
|
||||
return map->last_pa;
|
||||
if ((map->flags & FTL_CACHED_VA) && map->last_va == va) {
|
||||
if (map->flags & FTL_UNMAPPED)
|
||||
return -1;
|
||||
|
||||
if (page)
|
||||
*page = map->last_pa;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (new_page_desc)
|
||||
new_page_desc->va = va;
|
||||
|
@ -421,6 +428,7 @@ int trace_path(struct ftl_map *map, struct ftl_page_desc *new_page_desc,
|
|||
*page = upage;
|
||||
|
||||
map->flags |= FTL_CACHED_VA;
|
||||
map->flags &= ~FTL_UNMAPPED;
|
||||
map->last_va = va;
|
||||
map->last_pa = upage;
|
||||
|
||||
|
@ -433,5 +441,8 @@ err_not_found:
|
|||
}
|
||||
}
|
||||
|
||||
map->flags |= FTL_CACHED_VA | FTL_UNMAPPED;
|
||||
map->last_va = va;
|
||||
|
||||
return -ERR_NOT_FOUND;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue