Folded rbyd.erased into rbyd.off=block_size, some rbyd cleanup
- The erased flag in lfsr_rbyd_t uses only a single bit, which is wasteful for a heavily used struct in littlefs. We can use rbyd.off=block_size to indicate the same state for free. Note that when rbyd.off=block_size, we must treat rbyd as unerased anyways. - Improved state handling in rbyd_append/commit when an error occurs. I will be trying to make better use of cleanup gotos to make these functions less unpredictable when an error occurs. Hopefully the state of littlefs after an error can be well-defined in the future. - Fixed sign-mismatch warnings in asserts when compiled outside of the test runner.
This commit is contained in:
@@ -332,13 +332,12 @@ typedef struct lfs_cache {
|
||||
|
||||
typedef struct lfsr_rbyd {
|
||||
lfs_block_t block;
|
||||
uint32_t rev;
|
||||
// off=block_size => rbyd not erased/needs compaction
|
||||
lfs_off_t off;
|
||||
uint32_t crc;
|
||||
lfs_off_t trunk;
|
||||
lfs_size_t weight;
|
||||
// TODO can we get rid of erased? use sign bit of off maybe?
|
||||
bool erased;
|
||||
uint32_t rev;
|
||||
uint32_t crc;
|
||||
} lfsr_rbyd_t;
|
||||
|
||||
//typedef struct lfsr_btree {
|
||||
|
||||
Reference in New Issue
Block a user