diff --git a/source/fs/mufs/block.c b/source/fs/mufs/block.c index 969ca6f..ca6f90b 100644 --- a/source/fs/mufs/block.c +++ b/source/fs/mufs/block.c @@ -32,6 +32,9 @@ int mufs_mark_block(struct mufs *fs, uint32_t block, int status) sizeof data) == 0) return -1; + if (flash_sync(fs->dev) < 0) + return -1; + return 0; } diff --git a/source/fs/mufs/tree.c b/source/fs/mufs/tree.c index 4d4a3e7..381b0fe 100644 --- a/source/fs/mufs/tree.c +++ b/source/fs/mufs/tree.c @@ -61,6 +61,9 @@ static int mufs_do_lookup(struct mufs *fs, uint32_t *page, if (flash_write(dev, (base << dev->log2_block_size) + index * sizeof entry, &entry, sizeof entry) == 0) return -1; + + if (flash_sync(dev) < 0) + return -1; } return mufs_do_lookup(fs, page, entry, depth - 1, va, new_page, @@ -171,6 +174,11 @@ int mufs_extend_tree(struct mufs_tree *tree, uint8_t depth) return -1; } + if (flash_sync(dev) < 0) { + mufs_free_block(fs, root); + return -1; + } + tree->root = root; }