littlefs-project / littlefs

A little fail-safe filesystem designed for microcontrollers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blocks 0 and 1 becoming corrupted whilst creating just 1 file - Problem confirmed as block count being anything other than 512.

rapp70 opened this issue · comments

Hi..

Using version 2.8.

Creating scores of test files as part of a little fs test harness, failures are noted at various points.
Quickest route to failure (so far) is erasing the device, creating seven files, the first with a starting size of 85k, increasing each time by around 10k. The 7th file (around 175k) fails to create with block 0 & 1 having been corrupted.
Each file is created by successively appending blocks of up to 8K (so around 300 appends at the point of failure).
Flash / page writing independently checked and seems robust (all data written is also verified due to this issue).
Read/write sizes are 1, cache size is 256. Multiple read/write/cache sizes have been tested, but failure occurs at the same point.

Have tried versions all the way back to 2.0 - same failure, but at different points.

EDIT:
All 4096 blocks were used in the above tests. Reducing the partition size to 2048 block causes the failure to happen when creating the first file. Moving the partition around then fails identically (the first two blocks of the partition get corrupted).
Strangely, reducing the partition size (total number of blocks) by 1/200/500 etc allows a few more files to be created before the failure occurs.
The failure seems related to the number of appends made (not the number of files) - so that depending on the number of blocks, the fail point will always occur on the same append.

Any thoughts? Anything I can do that might help flush the issue out?

EDIT:
Thanks to issue 737 I was able to pin this down to block count. If it is anything other than 512 the test harness fails at various points. I can also move the 512 blocks around the device with no issue.

Solved - was working with incorrect device information. No issues with little fs that I can see.