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 {
44
44
/// Value zero is invalid, must be positive or -1.
45
45
const BLOCK_CYCLES : isize = -1 ;
46
46
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
+
47
53
/// littlefs uses a read cache, a write cache, and one cache per per file.
48
54
/// Must be a multiple of `READ_SIZE` and `WRITE_SIZE`.
49
55
/// 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> {
61
61
let lookahead_size: u32 = 8 * <Storage as driver:: Storage >:: LOOKAHEAD_SIZE :: U32 ;
62
62
let block_cycles: i32 = Storage :: BLOCK_CYCLES as _ ;
63
63
let block_count: u32 = Storage :: BLOCK_COUNT as _ ;
64
+ let metadata_max = Storage :: METADATA_MAX ;
64
65
65
66
debug_assert ! ( block_cycles >= -1 ) ;
66
67
debug_assert ! ( block_cycles != 0 ) ;
@@ -132,7 +133,7 @@ impl<Storage: driver::Storage> Allocation<Storage> {
132
133
name_max : filename_max_plus_one. wrapping_sub ( 1 ) ,
133
134
file_max,
134
135
attr_max,
135
- metadata_max : 0 ,
136
+ metadata_max,
136
137
} ;
137
138
138
139
Self {
Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ ram_storage!(
41
41
42
42
#[ test]
43
43
fn 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 ) ) ;
46
46
}
47
47
48
48
#[ test]
You can’t perform that action at this time.
0 commit comments