Home |
Function RTFDrvFlashCompact |
Function RTFDrvFlashCompactThis function can be used to execute the flash disk driver's garbage collection without actually writing data to the disk: int RTFDrvFlashCompact(RTFDrvFlashData * D, int RequestedSectors); ParametersDPointer to the linear flash driver's data for the specific flash disk used in the device list. RequestedSectorsSpecifies the minimum number of sectors that should be available when the function returns. return valueIf the function succeeds, the return value is the number of available sectors on the flash disk. If more sectors are requested than can be freed, the maximum possible number of sectors is made available and returned, but no error is reported. It is never necessary to explicitly call this function since the flash disk driver will execute its garbage collection automatically whenever data is written to the flash disk and not enough space is available. However, RTFDrvFlashCompact can be called before a write operation to speed up the write operation. If RTFDrvFlashCompact returns at least as many sectors as are to be written, RTFWrite (or any other disk write operation) is guaranteed not to erase any flash blocks during the write, allowing near real-time write performance. Note that freeing the last few sectors of a flash volume may take an excessive amount of time and is therefore not recommended. The number of sectors that can be made available can be determined with function RTFDrvFlashInfo (return values SectorsDeleted + SectorsAvailable). For performance reasons, it is recommended to leave at least one erase block worth of sectors unused.
|