eclipse-threadx/filex

Questions about FILEX's fault tolerant module

SUM-L opened this issue · 1 comments

SUM-L commented

Questions about FILEX's fault tolerant module:

  1. If power is turned off at _fx_fault_tolerant_create_log_file, will FAT entry be lost and fewer FAT entries available?

  2. What if the log file is full?

How are the following scenarios handled?

1, if there are currently three files A.txt(1MB), B.txt(1MB) and C.txt(1MB), then the three threads open A.txt, B.txt, C.txt, respectively, to update data from a certain location of the file in the way of overwriting.

  1. Open a new file, write a fixed byte (such as 512B) of data each time, cycle until the size of 1GB, and then close the file.

  2. After the fault tolerant function is enabled, how do you handle the SD card switching between the FILEX file system of the module and the FAT32 file system of the computer? This scenario is common on pluggable storage devices.

If power is turned off at _fx_fault_tolerant_create_log_file, will FAT entry be lost and fewer FAT entries available?
Yes. It is possible to lose clusters those can be used.

What if the log file is full?
The size of calculated maximum log file is less than 2800 bytes. The capacity of log file is 3K. So it will never happen.

if there are currently three files A.txt(1MB), B.txt(1MB) and C.txt(1MB), then the three threads open A.txt, B.txt, C.txt, respectively, to update data from a certain location of the file in the way of overwriting.
Each FileX APIs are thread safe. They will not be executed simultaneously. See https://github.com/azure-rtos/filex/blob/3d6e7b0bb0f992b46e0b050281a6d52f09ecfbdd/ports/generic/inc/fx_port.h#L121

After the fault tolerant function is enabled, how do you handle the SD card switching between the FILEX file system of the module and the FAT32 file system of the computer? This scenario is common on pluggable storage devices.
As long as the transaction is completed on both FileX and Windows, the data on SD card can be modified on both sides.