lfs.c:998:error: Corrupted dir pair at {0x1, 0x0}
Dear,
I ported the littlefs on STM32F4. After running hours, everything is fine. However, I met some random errror to fail mount the file system during startup. So I wrote a small loop to write data into the file system. The file name increase 1 every time. And I get the below erros(it failed after create 300 files successfully):
SPI_FLASH_READ 0x1004000 4096 SPI_FLASH_READ 0xE54000 4096 NorFlash: Erase at 0xE53000 NorFlash: write date at 0xE53000. size 256, NorFlash: write date at 0xE53100. size 256, chip id 0 NorFlash: write date at 0xE53200. size 256, chip id 0 NorFlash: write date at 0xE53300. size 256, chip id 0 NorFlash: write date at 0xE53400. size 256, chip id 0 NorFlash: write date at 0xE53500. size 256, chip id 0 NorFlash: write date at 0xE53600. size 256, chip id 0 NorFlash: write date at 0xE53700. size 256, chip id 0 NorFlash: write date at 0xE53800. size 256, chip id 0 NorFlash: write date at 0xE53900. size 256, chip id 0 NorFlash: write date at 0xE53A00. size 256, chip id 0 NorFlash: write date at 0xE53B00. size 256, chip id 0 NorFlash: write date at 0xE53C00. size 256, chip id 0 NorFlash: write date at 0xE53D00. size 256, chip id 0 NorFlash: write date at 0xE53E00. size 256, chip id 0 NorFlash: write date at 0xE53F00. size 256, chip id 0 SPI_FLASH_READ 0xE53000 4096 /tmp/test301--Done----- SPI_FLASH_READ 0x0 4096 SPI_FLASH_READ 0x1000 4096 SPI_FLASH_READ 0x0 4096 ../Src/Models/FileSystem/lfs.c:998:error: Corrupted dir pair at {0x1, 0x0} Fail to open file /tmp/test302 for writing, ret: -84 /tmp/test302--Done----- SPI_FLASH_READ 0x1000 4096 SPI_FLASH_READ 0x0 4096 ../Src/Models/FileSystem/lfs.c:998:error: Corrupted dir pair at {0x1, 0x0} Fail to open file /tmp/test303 for writing, ret: -84
My parameter are as follow : static uint8_t fs_read_buffer[4096] = {0}; static uint8_t fs_prog_buffer[4096] = {0}; static uint8_t fs_lookahead_buffer[4096] = {0};
static const struct lfs_config fs_cfg = { // block device operations .read = &block_device_read, .prog = &block_device_prog, .erase = &block_device_erase, .sync = &block_device_sync,
.read_size = 4096,
.prog_size = 4096,
.block_size = 4096,
.block_count = 32768,
.block_cycles = 500,
.cache_size = 4096,
.lookahead_size = 4096,
.read_buffer = fs_read_buffer,
.prog_buffer = fs_prog_buffer,
.lookahead_buffer = fs_lookahead_buffer,
};
I use latest version of lfs. The problem can been reproduced. Please tell me how I can fix it. Thanks.
regards
Source: littlefs-project/littlefs