mufs: allocate a block for the root, if no root has been allocated in mufs_alloc_page()

This commit is contained in:
S.J.R. van Schaik 2017-05-29 18:56:14 +02:00
parent 55ce3b8798
commit abe656c640

View file

@ -49,6 +49,9 @@ int mufs_lookup_page(struct mufs *fs, struct mufs_tree *tree, uint32_t *page,
int mufs_alloc_page(struct mufs *fs, struct mufs_tree *tree, uint32_t *page,
uint32_t va)
{
if (!tree->root && mufs_alloc_block(fs, &tree->root) < 0)
return -1;
return mufs_do_lookup(fs, page, tree->root, tree->depth, va, 1);
}