forked from Imagelibrary/littlefs
Moved revision count noise behind ifdef LFS_NOISY
littlefs is intentionally designed to not rely on noise, even with cksum
collisions (hello, perturb bit!). So it makes sense for this to be an
optional feature, even if it's a small one.
Disabling revision count noise by default also helps with testing. The
whole point of revision count noise is to make cksum collisions less
likely, which is a bit counterproductive when that's something we want
to test!
This doesn't really change the revision count encoding:
vvvvrrrr rrrrrrnn nnnnnnnn nnnnnnnn
'-.''----.----''---------.--------'
'------|---------------|---------- 4-bit relocation revision
'---------------|---------- recycle-bits recycle counter
'---------- pseudorandom noise (optional)
I considered moving the recycle-bits down when we're not adding noise,
but the extra logic just isn't worth making the revision count a bit
more human-readable.
---
This saves a small bit of code in the default build, at the cost of some
code for the runtime checks in the LFS_NOISY build. Though I'm hoping
future config work will let users opt-out of these runtime checks:
code stack ctx
before: 38548 2624 640
default after: 38508 (-0.1%) 2624 (+0.0%) 640 (+0.0%)
LFS_NOISY after: 38568 (+0.1%) 2624 (+0.0%) 640 (+0.0%)
Honestly the thing I'm more worried about is using one of our precious
mount flags for this... There's not that many bits left!
This commit is contained in:
@@ -57,6 +57,7 @@ FLAGS = [
|
||||
# Filesystem format flags
|
||||
('F', 'MODE', 1, "Format's access mode" ),
|
||||
('^', 'RDWR', 0, "Format the filesystem as read and write" ),
|
||||
('F', 'NOISY', 0x00000010, "Add noise to revision counts" ),
|
||||
('F', 'CKPROGS', 0x00000800, "Check progs by reading back progged data" ),
|
||||
('F', 'CKFETCHES', 0x00001000, "Check block checksums before first use" ),
|
||||
('F', 'CKPARITY', 0x00002000, "Check metadata tag parity bits" ),
|
||||
@@ -72,6 +73,7 @@ FLAGS = [
|
||||
('^', 'RDONLY', 1, "Mount the filesystem as read only" ),
|
||||
('M', 'FLUSH', 0x00000040, "Open all files with LFS_O_FLUSH" ),
|
||||
('M', 'SYNC', 0x00000080, "Open all files with LFS_O_SYNC" ),
|
||||
('M', 'NOISY', 0x00000010, "Add noise to revision counts" ),
|
||||
('M', 'CKPROGS', 0x00000800, "Check progs by reading back progged data" ),
|
||||
('M', 'CKFETCHES', 0x00001000, "Check block checksums before first use" ),
|
||||
('M', 'CKPARITY', 0x00002000, "Check metadata tag parity bits" ),
|
||||
@@ -97,6 +99,7 @@ FLAGS = [
|
||||
('I', 'RDONLY', 0x00000001, "Mounted read only" ),
|
||||
('I', 'FLUSH', 0x00000040, "Mounted with LFS_M_FLUSH" ),
|
||||
('I', 'SYNC', 0x00000080, "Mounted with LFS_M_SYNC" ),
|
||||
('I', 'NOISY', 0x00000010, "Mounted with LFS_M_NOISY" ),
|
||||
('I', 'CKPROGS', 0x00000800, "Mounted with LFS_M_CKPROGS" ),
|
||||
('I', 'CKFETCHES', 0x00001000, "Mounted with LFS_M_CKFETCHES" ),
|
||||
('I', 'CKPARITY', 0x00002000, "Mounted with LFS_M_CKPARITY" ),
|
||||
|
||||
Reference in New Issue
Block a user