File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ pub trait Storage {
4444 /// Value zero is invalid, must be positive or -1.
4545 const BLOCK_CYCLES : isize = -1 ;
4646
47+ // Optional upper limit on total space given to metadata pairs in bytes. On
48+ // devices with large blocks (e.g. 128kB) setting this to a low size (2-8kB)
49+ // can help bound the metadata compaction time. Must be <= block_size.
50+ // Defaults to block_size when zero.
51+ const METADATA_MAX : u32 = 0 ;
52+
4753 /// littlefs uses a read cache, a write cache, and one cache per per file.
4854 /// Must be a multiple of `READ_SIZE` and `WRITE_SIZE`.
4955 /// Must be a factor of `BLOCK_SIZE`.
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ impl<Storage: driver::Storage> Allocation<Storage> {
6161 let lookahead_size: u32 = 8 * <Storage as driver:: Storage >:: LOOKAHEAD_SIZE :: U32 ;
6262 let block_cycles: i32 = Storage :: BLOCK_CYCLES as _ ;
6363 let block_count: u32 = Storage :: BLOCK_COUNT as _ ;
64+ let metadata_max = Storage :: METADATA_MAX ;
6465
6566 debug_assert ! ( block_cycles >= -1 ) ;
6667 debug_assert ! ( block_cycles != 0 ) ;
@@ -132,7 +133,7 @@ impl<Storage: driver::Storage> Allocation<Storage> {
132133 name_max : filename_max_plus_one. wrapping_sub ( 1 ) ,
133134 file_max,
134135 attr_max,
135- metadata_max : 0 ,
136+ metadata_max,
136137 } ;
137138
138139 Self {
Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ ram_storage!(
4141
4242#[ test]
4343fn version ( ) {
44- assert_eq ! ( crate :: version( ) . format, ( 2 , 0 ) ) ;
45- assert_eq ! ( crate :: version( ) . backend, ( 2 , 2 ) ) ;
44+ assert_eq ! ( crate :: version( ) . format, ( 2 , 1 ) ) ;
45+ assert_eq ! ( crate :: version( ) . backend, ( 2 , 6 ) ) ;
4646}
4747
4848#[ test]
You can’t perform that action at this time.
0 commit comments