|
|
|
@ -25,6 +25,11 @@ size_t ftl_read(struct ftl_map *map, void *data, size_t len, uint32_t va) |
|
|
|
|
int ret; |
|
|
|
|
uint32_t mask, offset, page; |
|
|
|
|
|
|
|
|
|
if (!data) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
len = min(len, (1 << map->log2_page_size) - offset); |
|
|
|
|
|
|
|
|
|
mask = ((1 << map->log2_page_size) - 1); |
|
|
|
|
offset = va & mask; |
|
|
|
|
va >>= map->log2_page_size; |
|
|
|
@ -34,11 +39,6 @@ size_t ftl_read(struct ftl_map *map, void *data, size_t len, uint32_t va) |
|
|
|
|
return len; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!data) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
len = min(len, (1 << map->log2_page_size) - offset); |
|
|
|
|
|
|
|
|
|
return flash_read(map->dev, (page << map->log2_page_size) + offset, data, |
|
|
|
|
len); |
|
|
|
|
} |
|
|
|
|