Added on-mount traversal flags: LFS_M_MKCONSISTENT/CKMETA/CKDATA/etc
These tell littlefs to do the relevant gc work during mount, which may
be more convenient than calling lfsr_mount and then lfsr_fs_gc.
It also implicitly tears down the filesystem on error, which you can
imagine would be quite useful for LFS_M_CKMETA/LFS_M_CKDATA.
Some flags are more useful here than other (is LFS_M_LOOKAHEAD/COMPACT
really useful?), but since we just pass these directly to our traversal
APIs, we might as well support all of them for consistency.
Also note that since these only change mount's behavior, and have no
effect on the rest of the filesystem, these LFS_M_* flags don't have
related LFS_I_* flags and are not returned by lfsr_fs_stat.
---
This added quite a chunk of code, considering that this is entirely for
convenience:
code stack
before: 35932 2680
after: 36280 (+1.0%) 2680 (+0.0%)
But I think this is mostly because our low-level traversal state is
relatively costly to manage. It may be possible to deduplicate this a
bit better...
This commit is contained in:
@@ -117,14 +117,21 @@ enum lfs_error {
|
||||
enum lfs_mount_flags {
|
||||
LFS_M_RDWR = 0x0000, // Mount the filesystem as read and write
|
||||
LFS_M_RDONLY = 0x0001, // Mount the filesystem as read only
|
||||
LFS_M_CKPROGS = 0x0010, // Check progs by reading back progged data
|
||||
LFS_M_CKPROGS = 0x0008, // Check progs by reading back progged data
|
||||
|
||||
LFS_M_MTREEONLY = 0x0010, // Only traverse the mtree
|
||||
LFS_M_MKCONSISTENT = 0x0020, // Make the filesystem consistent
|
||||
LFS_M_LOOKAHEAD = 0x0040, // Populate lookahead buffer
|
||||
LFS_M_COMPACT = 0x0080, // Compact metadata logs
|
||||
LFS_M_CKMETA = 0x0100, // Check metadata checksums
|
||||
LFS_M_CKDATA = 0x0200, // Check metadata + data checksums
|
||||
};
|
||||
|
||||
// Filesystem info flags
|
||||
enum lfs_fsinfo_flags {
|
||||
// mount flags
|
||||
LFS_I_RDONLY = 0x0001, // Filesystem mounted read only
|
||||
LFS_I_CKPROGS = 0x0010, // Check progs by reading back progged data
|
||||
LFS_I_CKPROGS = 0x0008, // Check progs by reading back progged data
|
||||
|
||||
// state flags
|
||||
LFS_I_INCONSISTENT = 0x0100, // Filesystem needs mkconsistent to write
|
||||
|
||||
Reference in New Issue
Block a user