Added LFS3_2BONLY for a small 2-block configuration
Like LFS3_RDONLY and LFS3_KVONLY, LFS3_2BONLY opts-out of all of the
logic necessary for filesystems larger than 2-blocks (the mimimum size
of a mutable littlefs image).
This has potential for some pretty big savings:
- No block allocation
- No lookahead buffer
- No btrees (but yes bshrubs)
- No bptrs
- No mtree traversal
Which is I guess ~1/4 of the codebase:
code stack ctx
default: 37836 2416 636
2bonly: 27704 (-26.8%) 1872 (-22.5%) 592 (-6.9%)
This can be combined with LFS3_KVONLY for a small key-value store
compatible with the full littlefs driver:
code stack ctx
default: 37836 2416 636
kvonly: 30792 (-18.6%) 2168 (-10.3%) 636 (+0.0%)
kvonly+2bonly: 22900 (-39.5%) 1736 (-28.1%) 592 (-6.9%)
It may be possible to optimize this further, but, as is the case with
LFS3_KVONLY, balancing config-specific optimization vs maintainability
is tricky.
---
I'm not sure why, but this also reduced the default build's size a bit.
Compiler noise?
code stack ctx
before: 37860 2416 636
after: 37836 (-0.1%) 2416 (+0.0%) 636 (+0.0%)
This commit is contained in:
@@ -56,6 +56,9 @@
|
||||
#ifdef LFS3_YES_KVONLY
|
||||
#define LFS3_KVONLY
|
||||
#endif
|
||||
#ifdef LFS3_YES_2BONLY
|
||||
#define LFS3_2BONLY
|
||||
#endif
|
||||
#ifdef LFS3_YES_REVDBG
|
||||
#define LFS3_REVDBG
|
||||
#endif
|
||||
@@ -206,6 +209,12 @@
|
||||
#define LFS3_IFDEF_KVONLY(a, b) (b)
|
||||
#endif
|
||||
|
||||
#ifdef LFS3_2BONLY
|
||||
#define LFS3_IFDEF_2BONLY(a, b) (a)
|
||||
#else
|
||||
#define LFS3_IFDEF_2BONLY(a, b) (b)
|
||||
#endif
|
||||
|
||||
#ifdef LFS3_REVDBG
|
||||
#define LFS3_IFDEF_REVDBG(a, b) (a)
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user