On 1/18/07, Waldemar Kornewald <wkornewald@xxxxxxxxxxxx> wrote:
Hi, On 1/18/07, François Revol <revol@xxxxxxx> wrote: > Ideally each device driver would report its liking in terms of usage. > A simple way would be to just use the removable flag to force sync ops > and disable periodical syncing. Aren't specifically removable drives vulnerable to losing data because the user forgot to unmount? I've seen *waaay* to many users just unplug their USB stick in WinXP and Linux without prior unmounting. Of course, this problem doesn't exist with all removable drives. The system should take into account if the volume must be ejected with a button (and if this signal can be intercepted).
Sometimes Windows XP decides to disable the write cache on removable drives, forcing every operation to be done synchronously; unmounting these devices essentially mean flushing the caches onto the media, and since the write operations would be synchronous, there would be no cache to flush. I guess François meant that. However that just kills performance. So we're left with some options. Not to cache writes and force them to happen synchronously and kiss goodbye every hope for performance (eek); to cache writes, sync them from time to time and give the final syncing job to the unmount operation (more reasonable and every OS is doing that nowadays); or the perhaps best option which I'm yet to find implemented in ANY operating system: To put a pseudo full journal (not only metadata) on top of every removable media and warn the user if there were any uncommited write jobs the moment he ejected the media, asking him to kindly reinsert it and wait for the progress meter on the dialog to complete before removing it again. It would have to be FS independent, like the gjournal GEOM layer being developed for FreeBSD 7. But we don't really need that level of sophistication to implement this idea; a relatively easy implementation is to just log all the write operations and them flush as appropriate, or maybe layering a sparse image on top of the removable media FS and commit the changes as appropriate; the latter happens to be very similar to how VMWare and QEMU 0.8.2 handle snapshots.