|
|
@ -44,24 +44,18 @@ size_t ftl_read(struct ftl_map *map, void *data, size_t len, uint32_t va) |
|
|
|
len); |
|
|
|
len); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int ftl_seek(struct ftl_map *map, uint32_t va) |
|
|
|
static int ftl_start_transaction(struct ftl_map *map, uint32_t va) |
|
|
|
{ |
|
|
|
{ |
|
|
|
size_t len; |
|
|
|
uint32_t page; |
|
|
|
int ret; |
|
|
|
int ret; |
|
|
|
uint32_t offset, page, dst, src; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (va >= ftl_get_capacity(map)) |
|
|
|
if ((map->outstanding.flags & FTL_PRESENT) && map->outstanding.va == va) |
|
|
|
return -1; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
offset = va & ((1 << map->log2_page_size) - 1); |
|
|
|
|
|
|
|
va >>= map->log2_page_size; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!(map->outstanding.flags & FTL_PRESENT) || map->outstanding.va != va) { |
|
|
|
|
|
|
|
if (ftl_sync(map) < 0) |
|
|
|
if (ftl_sync(map) < 0) |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
if ((ret = trace_path(map, NULL, &page, va)) < 0 && |
|
|
|
if ((ret = trace_path(map, NULL, &page, va)) < 0 && ret != -ERR_NOT_FOUND) |
|
|
|
ret != -ERR_NOT_FOUND) |
|
|
|
|
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
if (prepare_head(map) < 0) |
|
|
|
if (prepare_head(map) < 0) |
|
|
@ -77,7 +71,24 @@ static int ftl_seek(struct ftl_map *map, uint32_t va) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
map->offset = 0; |
|
|
|
map->offset = 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int ftl_seek(struct ftl_map *map, uint32_t va) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
size_t len; |
|
|
|
|
|
|
|
uint32_t offset, dst, src; |
|
|
|
|
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (va >= ftl_get_capacity(map)) |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
offset = va & ((1 << map->log2_page_size) - 1); |
|
|
|
|
|
|
|
va >>= map->log2_page_size; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ftl_start_transaction(map, va) < 0) |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
if (offset < map->offset) |
|
|
|
if (offset < map->offset) |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|