Extended lfsr_format with some gc flags
These fall out quite naturally when you consider that we call
lfsr_mountinited internally to check that our format was successful.
That being said... they don't really do anything right now since we only
write a single mdir:
- LFS_F_COMPACT - The only gc operation that _might_ actually do
something is LFS_F_COMPACT, but only if our fs config exceeds >1/2 the
block size. But I'm not sure littlefs will even be able to write file
metadata if this happens...
- LFS_F_CKMETA - We already check the only mdir by calling
lfsr_mountinited, which implicitly fetches the mrootanchor.
- LFS_F_CKDATA - We uh, don't have any data immediately after
lfsr_format. But I guess it doesn't hurt to keep this around for
consistency, it at least implies CKMETA.
Hopefully these flags will be more interesting if/when we start adding
auxiliary trees to the filesystem, otherwise they may be worth reverting
in the future...
Until then, they at least provide some consistency, and I guess a way to
triply check that format was successful.
---
This could probably be better deduplicated, but calling lfsr_fs_gc from
both lfsr_mount and lfsr_format provides a bit better code organization:
code stack
before: 36448 2680
after: 36480 (+0.1%) 2680 (+0.0%)
This commit is contained in:
@@ -158,6 +158,11 @@ enum lfs_type {
|
||||
#define LFS_F_CKREADS 0x00000020 // Check reads via parity bits/checksums
|
||||
#endif
|
||||
|
||||
#define LFS_F_MTREEONLY 0x00010000 // Only traverse the mtree
|
||||
#define LFS_F_COMPACT 0x00000800 // Compact metadata logs
|
||||
#define LFS_F_CKMETA 0x00001000 // Check metadata checksums
|
||||
#define LFS_F_CKDATA 0x00002000 // Check metadata + data checksums
|
||||
|
||||
// Filesystem mount flags
|
||||
#define LFS_M_RDWR 0 // Mount the filesystem as read and write
|
||||
#define LFS_M_RDONLY 1 // Mount the filesystem as read only
|
||||
|
||||
Reference in New Issue
Block a user