ftl: maintain state for the transaction that is currently active

This commit is contained in:
S.J.R. van Schaik 2017-10-03 13:15:10 +02:00
parent e40bd819d6
commit 65d269e2d4
4 changed files with 38 additions and 60 deletions

View file

@ -15,11 +15,14 @@ struct ftl_page_desc {
uint32_t subtrees[32];
} __attribute__((packed));
struct ftl_tlb_entry {
uint32_t va, page;
uint8_t flags;
};
struct ftl_map {
struct flash_dev *dev;
unsigned flags;
uint32_t last_va;
uint32_t last_pa;
struct ftl_tlb_entry outstanding;
uint32_t offset;
uint32_t head, tail;
uint32_t root;
@ -33,9 +36,9 @@ struct ftl_map {
uint8_t epoch;
};
#define FTL_CACHED_VA BIT(0)
#define FTL_UNMAPPED BIT(1)
#define FTL_DIRTY BIT(2)
#define FTL_PRESENT BIT(7)
#define FTL_NO_MAPPING BIT(6)
#define FTL_AGE(x) (x & BITS(0, 3))
#define FTL_MAX_ATTEMPTS 8