Skip to content

Commit

Permalink
Added more block_size/count inference tests and fixed a couple bugs
Browse files Browse the repository at this point in the history
- Need to drop cache during block_size search.

- Removed "Corrupted" messages when root is not found to avoid too much debug
  output. This also gets rid of a long-term point of confusion arround
  "Corrupted" messages on a mount that is intended to fail.
  • Loading branch information
geky committed Dec 7, 2022
1 parent 0aa0c84 commit 2450e83
Show file tree
Hide file tree
Showing 2 changed files with 327 additions and 14 deletions.
10 changes: 8 additions & 2 deletions lfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1299,8 +1299,10 @@ static lfs_stag_t lfs_dir_fetchmatch(lfs_t *lfs,
dir->rev = revs[(r+1)%2];
}

LFS_ERROR("Corrupted dir pair at {0x%"PRIx32", 0x%"PRIx32"}",
dir->pair[0], dir->pair[1]);
if (!lfs_pair_isnull(lfs->root)) {
LFS_ERROR("Corrupted dir pair at {0x%"PRIx32", 0x%"PRIx32"}",
dir->pair[0], dir->pair[1]);
}
return LFS_ERR_CORRUPT;
}

Expand Down Expand Up @@ -4231,6 +4233,10 @@ static int lfs_rawmount(lfs_t *lfs, const struct lfs_config *cfg) {
lfs->block_count /= lfs->block_size/lfs->erase_size;
}

// make sure cached data from a different block_size doesn't cause
// problems, we should never visit the same mdir twice here anyways
lfs_cache_drop(lfs, &lfs->rcache);

// scan directory blocks for superblock and any global updates
lfs_mdir_t dir = {.tail = {0, 1}};
lfs_block_t cycle = 0;
Expand Down
Loading

0 comments on commit 2450e83

Please sign in to comment.