[Lazarus] Using Lazarus on Embedded Linux?
Henry Vermaak
henry.vermaak at gmail.com
Mon Sep 27 12:13:41 CEST 2010
On 27/09/10 10:50, Mark Morgan Lloyd wrote:
> Henry Vermaak wrote:
>> On 27/09/10 08:50, Michael Schnell wrote:
>>> On 09/25/2010 09:07 AM, Bo Berglund wrote:
>
>>> After writing to the card, same performs the storage procedure
>>> internally which takes a undefined amount of time and can't be watched
>>> from outside. So you don't know how long you need to apply power to the
>>> card after switching off the system. If you remove the power to the card
>>> too early, _all_ (even unrelated) data on the card might be lost. This
>>> is why using a special file system (a Flash File system and/or a
>>> journaling file system) does not help.
>>
>> See sync, fsync, fdatasync, etc. You can also mount some filesystems
>> with sync, but that's usually not a good idea for performance and
>> flash cycle issues. Best is to remove the power only after your kernel
>> has powered down, obviously, so you know that all the buffers have
>> been flushed.
>
> I think I'd like to see a clarification from Michael here: did he mean
> that the kernel/filesystem/drivers take an indefinite time committing
> the data or that the card takes an indefinite time after receiving data
> from the operating system?
>
> The first of those can at least be initiated using a sync() call, and
> it's reasonable to assume that a filesystem designed for the purpose
> won't get screwed if the driver finds it can no longer talk to the
> storage device. However if the storage device itself is susceptible to
> errors caused by power removal that is far more sinister.
The only delay I can see (after fsync) would be due to the hardware
cache of the disk in use (or a defective drive). On linux you can call
hdparm to flush on-disk caches.
Henry
More information about the Lazarus
mailing list