ftl: cache last virtual address translation

tags/0.1.0
S.J.R. van Schaik 8 years ago
parent bc50af00b6
commit 8f061a808d
  1. 2
      include/ftl.h
  2. 6
      source/ftl/map.c

@ -14,6 +14,8 @@ struct ftl_page_desc {
struct ftl_map {
struct flash_dev *dev;
uint32_t last_va;
uint32_t last_pa;
uint32_t head, tail;
uint32_t root;
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;
uint32_t upage = map->root;
if (map->last_va == va)
return map->last_pa;
if (new_page_desc)
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)
*page = upage;
map->last_va = va;
map->last_pa = upage;
return 0;
err_not_found:

Loading…
Cancel
Save