ftl: cache last virtual address translation
This commit is contained in:
parent
bc50af00b6
commit
8f061a808d
2 changed files with 8 additions and 0 deletions
|
@ -14,6 +14,8 @@ struct ftl_page_desc {
|
||||||
|
|
||||||
struct ftl_map {
|
struct ftl_map {
|
||||||
struct flash_dev *dev;
|
struct flash_dev *dev;
|
||||||
|
uint32_t last_va;
|
||||||
|
uint32_t last_pa;
|
||||||
uint32_t head, tail;
|
uint32_t head, tail;
|
||||||
uint32_t root;
|
uint32_t root;
|
||||||
uint32_t nused_pages;
|
uint32_t nused_pages;
|
||||||
|
|
|
@ -379,6 +379,9 @@ int trace_path(struct ftl_map *map, struct ftl_page_desc *new_page_desc,
|
||||||
uint8_t depth = 0;
|
uint8_t depth = 0;
|
||||||
uint32_t upage = map->root;
|
uint32_t upage = map->root;
|
||||||
|
|
||||||
|
if (map->last_va == va)
|
||||||
|
return map->last_pa;
|
||||||
|
|
||||||
if (new_page_desc)
|
if (new_page_desc)
|
||||||
new_page_desc->va = va;
|
new_page_desc->va = va;
|
||||||
|
|
||||||
|
@ -414,6 +417,9 @@ int trace_path(struct ftl_map *map, struct ftl_page_desc *new_page_desc,
|
||||||
if (page)
|
if (page)
|
||||||
*page = upage;
|
*page = upage;
|
||||||
|
|
||||||
|
map->last_va = va;
|
||||||
|
map->last_pa = upage;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_not_found:
|
err_not_found:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue