ftl: add ftl_get_size(), allow trimming final sector, recover tail and size
This commit is contained in:
parent
da30898794
commit
4b651b19f1
2 changed files with 51 additions and 6 deletions
|
@ -8,6 +8,7 @@ struct ftl_page_group {
|
|||
|
||||
struct ftl_page_desc {
|
||||
uint32_t va;
|
||||
uint32_t nused_pages;
|
||||
uint32_t subtrees[32];
|
||||
} __attribute__((packed));
|
||||
|
||||
|
@ -15,6 +16,7 @@ struct ftl_journal {
|
|||
struct flash_dev *dev;
|
||||
uint32_t head, tail;
|
||||
uint32_t root;
|
||||
uint32_t nused_pages;
|
||||
uint32_t nblocks;
|
||||
uint8_t log2_groups_per_block;
|
||||
uint8_t log2_pages_per_group;
|
||||
|
@ -32,4 +34,5 @@ int ftl_find(struct ftl_journal *j, uint32_t *loc, uint32_t va);
|
|||
int ftl_write(struct ftl_journal *j, uint32_t addr, const uint8_t *data);
|
||||
int ftl_read(struct ftl_journal *j, uint8_t *data, uint32_t va);
|
||||
int ftl_trim(struct ftl_journal *j, uint32_t va);
|
||||
uint32_t ftl_get_size(const struct ftl_journal *j);
|
||||
uint32_t ftl_get_capacity(const struct ftl_journal *j);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue