Tweaked debug prints to show more information during mount
Now when you mount littlefs, the debug print shows a bit more info:
lfs.c:7881:debug: Mounted littlefs v2.0 0x{0,1}.c63 w43.256, bd 4096x256
To dissassemble this a bit:
littlefs v2.0 0x{0,1}.c63 w43.256, bd 4096x256
^ ^ '-+-' ^ ^ ^ ^ ^
'-|-----|----|---|---|--------|---|-- major version
'-----|----|---|---|--------|---|-- minor version
'----|---|---|--------|---|-- mroot blocks
| | | | | (1st is active)
'---|---|--------|---|-- mroot trunk
'---|--------|---|-- mtree weight
'--------|---|-- mleaf weight
'---|-- block size
'-- block count
dbglfs.py also shows the block device geometry now, as read from the
mroot:
$ ./scripts/dbglfs.py disk -B4096
littlefs v2.0 0x{0,1}.c63, rev 1, weight 43.256, bd 4096x256
...
This may be over-optimizing for testing, but the reason the mount debug
is only one line is to avoid slowing down/messying test output. Both
powerloss testing and remounts completely fill the output with mount
prints that aren't actually all that useful.
Also switching to prefering parens in debug info mainly for mismatched
things.
This commit is contained in:
@@ -2384,8 +2384,8 @@ static int lfsr_rbyd_fetchvalidate(lfs_t *lfs, lfsr_rbyd_t *rbyd,
|
||||
int err = lfsr_rbyd_fetch(lfs, rbyd, block, trunk);
|
||||
if (err) {
|
||||
if (err == LFS_ERR_CORRUPT) {
|
||||
LFS_ERROR("Found corrupted rbyd "
|
||||
"(0x%"PRIx32".%"PRIx32", 0x%08"PRIx32")",
|
||||
LFS_ERROR("Found corrupted rbyd 0x%"PRIx32".%"PRIx32", "
|
||||
"cksum 0x%08"PRIx32,
|
||||
block, trunk, cksum);
|
||||
}
|
||||
return err;
|
||||
@@ -2397,8 +2397,8 @@ static int lfsr_rbyd_fetchvalidate(lfs_t *lfs, lfsr_rbyd_t *rbyd,
|
||||
// above fetch failing, since that would require the rbyd to have the
|
||||
// same trunk and pass its internal cksum
|
||||
if (rbyd->cksum != cksum) {
|
||||
LFS_ERROR("Found rbyd cksum mismatch "
|
||||
"(0x%"PRIx32".%"PRIx32", 0x%08"PRIx32" != 0x%08"PRIx32")",
|
||||
LFS_ERROR("Found rbyd cksum mismatch rbyd 0x%"PRIx32".%"PRIx32", "
|
||||
"cksum 0x%08"PRIx32" (!= 0x%08"PRIx32")",
|
||||
rbyd->block, rbyd->trunk, rbyd->cksum, cksum);
|
||||
return LFS_ERR_CORRUPT;
|
||||
}
|
||||
@@ -6955,7 +6955,7 @@ static int lfsr_traversal_read(lfs_t *lfs, lfsr_traversal_t *traversal,
|
||||
traversal->mdir.u.m.blocks,
|
||||
traversal->u.mtortoise.blocks) == 0) {
|
||||
LFS_ERROR("Cycle detected during mtree traversal "
|
||||
"(0x{%"PRIx32",%"PRIx32"})",
|
||||
"0x{%"PRIx32",%"PRIx32"}",
|
||||
traversal->mdir.u.m.blocks[0],
|
||||
traversal->mdir.u.m.blocks[1]);
|
||||
return LFS_ERR_CORRUPT;
|
||||
@@ -7041,7 +7041,7 @@ static int lfsr_traversal_read(lfs_t *lfs, lfsr_traversal_t *traversal,
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
LFS_ERROR("Weird mtree entry? (0x%"PRIx32")", tag);
|
||||
LFS_ERROR("Weird mtree entry? 0x%"PRIx32, tag);
|
||||
return LFS_ERR_CORRUPT;
|
||||
}
|
||||
|
||||
@@ -7119,7 +7119,7 @@ static int lfsr_traversal_read(lfs_t *lfs, lfsr_traversal_t *traversal,
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
LFS_ERROR("Weird mtree entry? (0x%"PRIx32")", binfo.tag);
|
||||
LFS_ERROR("Weird mtree entry? 0x%"PRIx32, binfo.tag);
|
||||
return LFS_ERR_CORRUPT;
|
||||
}
|
||||
|
||||
@@ -7878,9 +7878,16 @@ int lfsr_mount(lfs_t *lfs, const struct lfs_config *cfg) {
|
||||
|
||||
// TODO this should use any configured values
|
||||
LFS_DEBUG("Mounted littlefs v%"PRId32".%"PRId32" "
|
||||
"(bs=%"PRId32", bc=%"PRId32")",
|
||||
"0x{%"PRIx32",%"PRIx32"}.%"PRIx32" "
|
||||
"w%"PRId32".%"PRId32", "
|
||||
"bd %"PRId32"x%"PRId32,
|
||||
LFS_DISK_VERSION_MAJOR,
|
||||
LFS_DISK_VERSION_MINOR,
|
||||
lfs->mroot.u.m.blocks[0],
|
||||
lfs->mroot.u.m.blocks[1],
|
||||
lfs->mroot.u.m.trunk,
|
||||
lfsr_mtree_weight(lfs) / lfsr_mleafweight(lfs),
|
||||
lfsr_mleafweight(lfs),
|
||||
lfs->cfg->block_size,
|
||||
lfs->cfg->block_count);
|
||||
|
||||
@@ -7897,8 +7904,8 @@ int lfsr_format(lfs_t *lfs, const struct lfs_config *cfg) {
|
||||
return err;
|
||||
}
|
||||
|
||||
LFS_DEBUG("Formatting littlefs v%"PRId32".%"PRId32" "
|
||||
"(bs=%"PRId32", bc=%"PRId32")",
|
||||
LFS_DEBUG("Formatting littlefs v%"PRId32".%"PRId32", "
|
||||
"bd %"PRId32"x%"PRId32,
|
||||
LFS_DISK_VERSION_MAJOR,
|
||||
LFS_DISK_VERSION_MINOR,
|
||||
lfs->cfg->block_size,
|
||||
|
||||
+3
-2
@@ -1760,10 +1760,11 @@ def main(disk, mroots=None, *,
|
||||
#### actual debugging begins here
|
||||
|
||||
# print some information about the filesystem
|
||||
print('littlefs v%s.%s %s, rev %d, weight %d.%d' % (
|
||||
print('littlefs v%s.%s %s, rev %d, weight %d.%d, bd %dx%d' % (
|
||||
config.version[0] if config.version[0] is not None else '?',
|
||||
config.version[1] if config.version[1] is not None else '?',
|
||||
mroot.addr(), mroot.rev, bweight//mleaf_weight, 1*mleaf_weight))
|
||||
mroot.addr(), mroot.rev, bweight//mleaf_weight, 1*mleaf_weight,
|
||||
config.block_limit+1, config.disk_limit+1))
|
||||
|
||||
# dynamically size the id field
|
||||
w_width = max(
|
||||
|
||||
Reference in New Issue
Block a user