You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to answer a few questions I have regarding LittleFS page program behaviour. I would appreciate it if someone can correct me or confirm my understanding.
I am running LittleFS on a bunch of MT29F16G16ADACA flash chips. In the datasheet (table 33, page 109) it states:
Parameter
Symbol
Typ
Max
Unit
Notes
Number of partial-page programs
NOP
–
4
cycles
1
My understanding is that each page has a program limit of 4, after which the block it is in needs to be erased before the page can be programmed (reliably) again.
I've looked at the LittleFS docs but, I didn't see any documentation stating whether LittleFS will ever program the same page more than once, without first erasing the block it is in.
Arguably this is probably more trouble than it is worth as it would need to first read the page (assuming it doesn't have a copy in RAM), check if it can make the necessary changes by just flipping 1s to 0s, and if so write the changes, otherwise look for a new page.
According to my testing:
For inlined files:
LittleFS will program consecutive pages of the same block during each file write. When all pages in the block are exhausted, it will find a new unused/free block, erase it, write the file to the first page of the new block and mark the old block as unused/free.
For normal files:
It will program to a new block during each file write. Curiously, instead of programming consecutive blocks (like it programs consecutive pages when dealing with inlined files), it seems to split the block count in half and alternate to which half it programs to. For example, for a 32 block device, it will program to block 0, then 16, then 1, then 17, etc.
Questions:
Am I correct in assuming that LittleFS will never program the same page more than once without first erasing the block it is in?
In the case of an N-page wide block. If I store an inlined file on a single page, and then proceed to rewrite its contents N-1 times, does that mean that the inlined file now effectively occupies N pages, since all of the pages of the block have been written to?
If 2 is true, how can I prevent this? Run garbage collection? Disable inlined files? Rewrite the file N+1 times, so it gets moved to a new block?
Can multiple files (inlined or not) share the same block? What about the same page? If yes, does this change the answers to Q2 and Q3?
Thanks!
The text was updated successfully, but these errors were encountered:
Hi,
I am trying to answer a few questions I have regarding LittleFS page program behaviour. I would appreciate it if someone can correct me or confirm my understanding.
I am running LittleFS on a bunch of MT29F16G16ADACA flash chips. In the datasheet (table 33, page 109) it states:
My understanding is that each page has a program limit of 4, after which the block it is in needs to be erased before the page can be programmed (reliably) again.
I've looked at the LittleFS docs but, I didn't see any documentation stating whether LittleFS will ever program the same page more than once, without first erasing the block it is in.
Arguably this is probably more trouble than it is worth as it would need to first read the page (assuming it doesn't have a copy in RAM), check if it can make the necessary changes by just flipping
1
s to0
s, and if so write the changes, otherwise look for a new page.According to my testing:
LittleFS will program consecutive pages of the same block during each file write. When all pages in the block are exhausted, it will find a new unused/free block, erase it, write the file to the first page of the new block and mark the old block as unused/free.
It will program to a new block during each file write. Curiously, instead of programming consecutive blocks (like it programs consecutive pages when dealing with inlined files), it seems to split the block count in half and alternate to which half it programs to. For example, for a 32 block device, it will program to block 0, then 16, then 1, then 17, etc.
Questions:
N
-page wide block. If I store an inlined file on a single page, and then proceed to rewrite its contentsN-1
times, does that mean that the inlined file now effectively occupiesN
pages, since all of the pages of the block have been written to?N+1
times, so it gets moved to a new block?Thanks!
The text was updated successfully, but these errors were encountered: