ftl: use write_page_desc() in ftl_trim()

This commit is contained in:
S.J.R. van Schaik 2017-06-23 16:03:42 +02:00
parent 7a3e5a7679
commit 22028021ca
3 changed files with 7 additions and 2 deletions

View file

@ -125,7 +125,10 @@ int ftl_trim(struct ftl_map *map, uint32_t va)
alt_page << map->log2_page_size, 1 << map->log2_page_size) == 0)
return -1;
return write_upage(map, NULL, &page_desc);
if (prepare_head(map) < 0)
return -1;
return write_page_desc(map, &page_desc);
}
/* Returns the amount of used pages with a unique virtual address multiplied by

View file

@ -83,7 +83,7 @@ int read_page_desc(struct ftl_map *map,
/* Writes the page descriptor to the footer of the current page group and
* increments the head to point to the next free user page.
*/
static int write_page_desc(struct ftl_map *map,
int write_page_desc(struct ftl_map *map,
const struct ftl_page_desc *page_desc)
{
struct ftl_page_group group;

View file

@ -6,6 +6,8 @@ int read_page_group(struct ftl_map *map,
struct ftl_page_group *group, uint32_t group_no);
int read_page_desc(struct ftl_map *map,
struct ftl_page_desc *page_desc, uint32_t upage);
int write_page_desc(struct ftl_map *map,
const struct ftl_page_desc *page_desc);
int write_upage(struct ftl_map *map, const void *page,
const struct ftl_page_desc *page_desc);
int trace_path(struct ftl_map *map, struct ftl_page_desc *new_page_desc,