Commit Graph

34 Commits (bb155adc161deab6fb0aa648e5d0c6892d050d02)

Author SHA1 Message Date
Russ Butler bb155adc16 Add filesystem recovery tests
Add tests for filesystem resilience and wear leveling. These tests
take shared filesystem code and simulate different scenarios while
this code is running. Information on the new tests can be found below.

mbed-littlefs-tests-filesystem_recovery-resilience:
Tests that after every block device operation the filesystem is in a
well defined state.

mbed-littlefs-tests-filesystem_recovery-wear_leveling:
Tests that the littlefs correctly handles when flash is exhausted by
using a simulated block device until there are no free good blocks.

Note - This patch also adds several new block devices for testing.
These will eventually be moved into mbed-os.
2017-11-16 20:20:15 -06:00
Christopher Haster 7eaf61c047 Fixed memory leak when files/dirs error
Error path did not clean up after itself correctly
2017-11-16 18:55:23 -06:00
Christopher Haster 9f8d0d6ae8 Merge commit '0f4e334388e0e05554a78d14d0a5ef73f02209b2' 2017-11-16 18:23:51 -06:00
Christopher Haster 0f4e334388 Squashed 'littlefs/' changes from 3f31c8c..78c79ec
78c79ec Added QUIET flag to tests so CI is readable
f9f4f5c Fixed standard name mismatch LFS_ERR_EXISTS -> LFS_ERR_EXIST
843e3c6 Added sticky-bit for preventing file syncs after write errors
2612e1b Modified lfs_ctz_extend to be a little bit safer
6664723 Fixed issue with committing directories to bad-blocks that are stuck

git-subtree-dir: littlefs
git-subtree-split: 78c79ecb9e6b8dd0e7cfd7ac86934e43fb026924
2017-11-16 18:16:32 -06:00
Christopher Haster ee52d6dc42 Merge commit '3778759979a1c6bc141e9ced8c28df2a1d4a9848' into fix-lookaheads 2017-11-10 11:03:11 -06:00
Christopher Haster 3778759979 Squashed 'littlefs/' changes from 2ab150c..3f31c8c
3f31c8c Fixed corner case with immediate exhaustion and lookahead==block_count
f4aeb83 Fixed issue with aggressively rounding down lookahead configuration
db51a39 Removed stray newline in LFS_ERROR for version

git-subtree-dir: littlefs
git-subtree-split: 3f31c8cba31e0f6cef5b02dba2e050d8df1168b7
2017-11-10 11:02:50 -06:00
Christopher Haster d3b2efec9d Fixed corner case with immediate exhaustion and lookahead==block_count
The previous math for determining if we scanned all of disk wasn't set
up correctly in the lfs_mount function. If lookahead == block_count
the lfs_alloc function would think we had already searched the entire
disk.

This is only an issue if we manage to exhaust a block on the first
pass after mount, since lfs_alloc_ack resets the lookahead region
into a valid state after a succesful block allocation.
2017-11-10 10:54:52 -06:00
Christopher Haster 785b0b4bc4 Fixed issue with aggressively rounding down lookahead configuration
The littlefs allows buffers to be passed statically in the case
that a system does not have a heap. Unfortunately, this means we
can't round up in the case of an unaligned lookahead buffer.

Double unfortunately, rounding down after clamping to the block device
size could result in a lookahead of zero for block devices < 32 blocks
large.

The assert in littlefs does catch this case, but rounding down prevents
support for < 32 block devices.

The solution is to simply require a 32-bit aligned buffer with an
assert. This avoids runtime problems while allowing a user to pass
in the correct buffer for < 32 block devices. Rounding up can be
handled at higher API levels.
2017-11-10 10:54:47 -06:00
Christopher Haster 71b429ba66 Cleaned up compilation with logging enabled
- Removed list of warnings on signedness of integers in printf
- Fixed issue with "true" in ifdef
2017-11-09 18:33:06 -06:00
Christopher Haster 72fab82453 Added API level logging and logging configuration options 2017-10-31 17:58:21 -05:00
Christopher Haster 5e4ef9f5a4 Added simple high-level thread safety
All calls are blocking, so a single mutex is able
to garuntee synchronization across all relevant functions.
2017-10-31 17:58:16 -05:00
Christopher Haster 26ade6236a Merge commit '0171b57a04c3eb6444fdf1163e0e21993445bfd8' 2017-10-30 18:17:14 -05:00
Christopher Haster 0171b57a04 Squashed 'littlefs/' changes from 454b588..2ab150c
2ab150c Removed toolchain specific warnings
0825d34 Adopted alternative implementation for lfs_ctz_index
46e22b2 Adopted lfs_ctz_index implementation using popcount
4fdca15 Slight name change with ctz skip-list functions

git-subtree-dir: littlefs
git-subtree-split: 2ab150cc500d5b8233ec8ef6109efa363bf1d38c
2017-10-30 18:16:52 -05:00
Christopher Haster adbd0290f8 Added implementation of FileSystem::reformat 2017-10-26 17:09:56 -05:00
Christopher Haster 11440f6018 Removed toolchain specific warnings
- Comparisons with differently signed integer types
- Incorrectly signed constant
- Unreachable default returns
- Leaked uninitialized variables in relocate goto statements
2017-10-16 19:39:51 -05:00
Christopher Haster 6fc33f4d9c Fixed incorrect instruction in IAR ctz implementation
The RBIT instruction reverses the bits of a word, not REV
2017-10-16 17:52:35 -05:00
Christopher Haster 383677f604 Merge commit '3c3b0329d44d44a2d47a28c755658d7f1db6a085' 2017-10-12 20:43:59 -05:00
Christopher Haster 3c3b0329d4 Squashed 'littlefs/' changes from 9843402..454b588
454b588 Updated SPEC.md and DESIGN.md based on recent changes
f3578e3 Removed clamping to block size in ctz linked-list
83d4c61 Updated copyright
539409e Refactored deduplicate/deorphan step to single deorphan step
2936514 Added atomic move using dirty tag in entry type
ac9766e Added self-hosting fuzz test using littlefs-fuse
9db1a86 Added specification document

git-subtree-dir: littlefs
git-subtree-split: 454b588f73032f9621c264fba280ab7b3a216402
2017-10-12 20:42:30 -05:00
Christopher Haster 301232eb4e Ported lfs_util functions to IAR intrinsics
required intrinsics for:
- lfs_ctz
- lfs_npw2
2017-10-10 06:55:13 -05:00
Christopher Haster c390e89f17 Added self-hosting fuzz test using littlefs-fuse 2017-10-10 06:55:10 -05:00
Christopher Haster 9408f2ba2c Converted tests into mbed-style integration tests
- TESTS/filesystem for mbed OS filesystem APIs
- TESTS/filesystem_retarget for mbed OS retargeted stdlib APIs

converted:
- test_dirs
- test_files
- test_seek
- test_parallel
2017-09-26 20:18:50 -05:00
Christopher Haster 3a987334f6 Added user flag to pip install in travis 2017-09-26 20:11:31 -05:00
Christopher Haster b6455a36c2 Brought over additional testing configurations from littlefs 2017-09-26 20:11:31 -05:00
Christopher Haster 37edc35091 Merge commit '6e99fa9319d17f0aef418ae3989befc04ecf9096' into new-update 2017-09-26 20:09:57 -05:00
Christopher Haster 6e99fa9319 Squashed 'littlefs/' changes from c2283a2..9843402
9843402 Fixed incorrect return value from lfs_file_seek
273cb7c Fixed problem with lookaheads larger than block device
d9367e0 Fixed collection of multiblock directories
a83b2fe Added checks for out-of-bound seeks
a8fa5e6 Fixed some corner cases with paths
26dd49a Fixed issue with negative modulo with unaligned lookaheads
0982020 Fixed issue with cold-write after seek to block boundary

git-subtree-dir: littlefs
git-subtree-split: 984340225befc1e2330dd3b88f4048373eda0fce
2017-09-26 20:09:29 -05:00
Christopher Haster c9117d8cb5 Increased default lookahead to 512 blocks
Because lookahead is stored efficiently as a bit-vector, this only
requires a ram increase of 48 bytes (2.1% of benchmark), but decreases
the SD benchmark runtime cost by 32 seconds (21.9% of benchmark).

Note this is unimportant on devices with byte-reads such as NOR flash.
2017-07-23 15:12:13 -05:00
Christopher Haster 2e9f87d435 Updated littlefs to '76d00eb38cddfcc267f323c470142b9f4588d3ff' 2017-07-23 14:11:24 -05:00
Christopher Haster 76d00eb38c Squashed 'littlefs/' changes from 663e953..c2283a2
c2283a2 Extended entry tag to support attributes
8795f0e Added build size output to CI
47db7a7 Added sanity check for compiling example
476915f Removed a few "what"s from the documentation

git-subtree-dir: littlefs
git-subtree-split: c2283a2753619d82a1fdf27d799cd53f2eef9a80
2017-07-23 13:59:49 -05:00
Christopher Haster 64ff4b60eb Added support for Travis CI 2017-07-12 09:45:19 -05:00
Christopher Haster 953e19eef4 Added README and LICENSE 2017-07-12 09:45:15 -05:00
Christopher Haster c5868790bc Tweaked littlefs to fit into mbed
- Changed log statements to use the debug function
- Changed %d to %ld given the type of int32_t in arm-none-eabi-gcc. In
  mainstream gcc this is not the case and may cause problems to
  upstream.
2017-07-12 06:50:52 -05:00
Christopher Haster 98af79f087 Squashed 'littlefs/' content from commit 663e953
git-subtree-dir: littlefs
git-subtree-split: 663e953a5073ac8e459f60d18375f887f14e21a2
2017-07-12 04:44:33 -05:00
Christopher Haster c9062594b5 Merge commit '98af79f087e8d95b28614e982a144a122f2dcbda' as 'littlefs' 2017-07-12 04:44:33 -05:00
Christopher Haster 8fae39166b Initial commit 2017-07-12 04:40:59 -05:00