Implemented much more aggressive OOO-write emulation

Now, instead of reverting only the first block on powerloss, _all_
blocks since the last sync are reverted (except the in-flight block, if
you reverted that it would be the same as noop powerloss).

It was a bit frustrating trying to reproduce known holes in our sync
logic before this, but reverting all blocks really is the worst case,
so we should have quite a bit more confidence going forward.

This was a bit tricky to implement without memory leaks everywhere,
since we need to be able to resume for exhaustive powerloss testing. But
emubd's copy-on-write block emulation really shines here.
This commit is contained in:
Christopher Haster
2024-06-06 13:13:25 -05:00
parent 76ffb0e7b6
commit 780527d00a
2 changed files with 217 additions and 98 deletions
+2 -2
View File
@@ -140,8 +140,8 @@ typedef struct lfs_emubd {
lfs_emubd_io_t proged;
lfs_emubd_io_t erased;
lfs_emubd_powercycles_t power_cycles;
lfs_ssize_t ooo_block;
lfs_emubd_block_t *ooo_data;
lfs_emubd_block_t **ooo_before;
lfs_emubd_block_t **ooo_after;
lfs_emubd_disk_t *disk;
const struct lfs_emubd_config *cfg;