fsync() for FAT file system

Chris Johns chrisj at rtems.org
Sat May 5 00:59:50 UTC 2012


On 5/05/12 12:57 AM, Sebastian Huber wrote:
> On 05/04/2012 04:51 PM, Thomas Doerfler wrote:
>> Sebastian,
>>
>> if I get this code right, it actually parses each buffer of the _volume_
>> and ensures it is synced, so this is FAR from optimal ;-)
>
> If I understand the fat_get_fat_cluster() correctly it follows the chain
> of clusters of the file (initial value is fat_fd->cln).
>

Ouch.

>>
>> Syncing the device will defintivly be an improvement. For large files,
>> this will not be worse than syncing the file-specific buffers.
>>
>> Another area: For really "syncing" the file, would it make sense to also
>> ensure that the file/directory information is updated as far as possible
>> to make sure the FS contains as much information as possible to read
>> back the file (in case of a device or power loss)?
>
> It does actually this kind of operation in msdos_file_sync()
> (unfortunately without a synchronization request to the cache). This
> should be fixed as well.
>

Yes it should be fixed.

Chris



More information about the devel mailing list