littlefs-project / littlefs

A little fail-safe filesystem designed for microcontrollers
BSD 3-Clause "New" or "Revised" License
5.07k stars 785 forks source link

Max file size in nand flash #466

Open Dothrakki opened 4 years ago

Dothrakki commented 4 years ago

Hi

I am using the littlefs with winbond nand flash, w25n01gv, and all the basic functions are workingfine, even though i have ran into some performance issues.

i am facing some issues while trying increase the file size more than the block size. The the nand flash internal block size is 128k and which is the smallest erasable portion.The data is getting corrupted if i try to increase the lfs blocksize more than 128k.

i am using lfs release 2.14.

define LFS_READ_SIZE 4096

define LFS_PROG_SIZE 4096

define LFS_BLOCK_SIZE (1024*128)

define LFS_BLOCK_COUNT 1024

define LFS_CACHE_SIZE 4096

define LFS_LOOKAHEAD_SIZE 2048

define LFS_BLOCK_CYCLES 500

Also noticed that, the speed reduces drastically if the number of files increase more than 128. i saw some similar issues git and i understood that this is because of the way lfs is designed.

gofortime commented 4 years ago

I am using nand, and it's fine to use file size more than bock size (in my case 256KB).

Dothrakki commented 4 years ago

Thank you for the kind response.

can u please share your configuration? i am not sure why my data is getting corrupted.

geky commented 3 years ago

">block size" is when files stop being one block and start using the CTZ skip-list. Maybe try defining -DLFS_NO_INTRINSICS=1?

If that doesn't work I'm not really sure what's going on unfortunately...