|
|
|
@ -582,21 +582,21 @@ static int ftl_write_upage(struct ftl_journal *j, const uint8_t *page, |
|
|
|
|
return ftl_write_page_desc(j, page_desc); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int ftl_read(struct ftl_journal *j, uint8_t *data, uint32_t va) |
|
|
|
|
int ftl_read(struct ftl_journal *j, uint8_t *data, size_t len, uint32_t va) |
|
|
|
|
{ |
|
|
|
|
int ret; |
|
|
|
|
uint32_t page; |
|
|
|
|
|
|
|
|
|
if ((ret = trace_path(j, NULL, &page, va)) < 0) { |
|
|
|
|
if (ret != -ERR_NOT_FOUND) |
|
|
|
|
return -1; |
|
|
|
|
memset(data, 0, len); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
memset(data, 0, j->log2_page_size); |
|
|
|
|
if (!data) |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return flash_read(j->dev, page << j->log2_page_size, data, |
|
|
|
|
j->log2_page_size); |
|
|
|
|
min(j->log2_page_size, len)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int ftl_write(struct ftl_journal *j, uint32_t va, const uint8_t *data) |
|
|
|
|