ftl: copy the page of the cousin instead of the page to trim in ftl_trim()

tags/0.1.0
S.J.R. van Schaik 8 years ago
parent bc28781181
commit 1ba4e77dd6
  1. 8
      source/ftl/ftl.c

@ -82,7 +82,7 @@ int ftl_trim(struct ftl_map *map, uint32_t va)
{
struct ftl_page_desc page_desc, alt_page_desc;
size_t level, i;
uint32_t alt_va, page;
uint32_t alt_page, page;
int ret;
if ((ret = trace_path(map, &page_desc, &page, va)) < 0) {
@ -97,7 +97,7 @@ int ftl_trim(struct ftl_map *map, uint32_t va)
for (i = 0; i < 32; ++i) {
level = 32 - i - 1;
if ((alt_va = page_desc.subtrees[level]) != UINT32_MAX)
if ((alt_page = page_desc.subtrees[level]) != UINT32_MAX)
break;
}
@ -110,7 +110,7 @@ int ftl_trim(struct ftl_map *map, uint32_t va)
return write_upage(map, NULL, &page_desc);
}
if (read_page_desc(map, &alt_page_desc, alt_va) < 0)
if (read_page_desc(map, &alt_page_desc, alt_page) < 0)
return -1;
page_desc.va = alt_page_desc.va;
@ -122,7 +122,7 @@ int ftl_trim(struct ftl_map *map, uint32_t va)
}
if (flash_copy(map->dev, map->head << map->log2_page_size,
page << map->log2_page_size, 1 << map->log2_page_size) < 0)
alt_page << map->log2_page_size, 1 << map->log2_page_size) < 0)
return -1;
return write_upage(map, NULL, &page_desc);

Loading…
Cancel
Save