Subject: Re: Detaching live sd devices
To: None <tech-kern@netbsd.org>
From: Michael van Elst <mlelstv@serpens.de>
List: tech-kern
Date: 07/25/2005 19:59:10
thorpej@shagadelic.org (Jason Thorpe) writes:

>...and on the Amiga, was there a way to yank the disk out of a hot- 
>plug port?

There were no hotplug devices at that time, but yanking out the
removable media is almost the same. An I/O operation in progress
fails (possibly having corrupted data but which is still buffered)
or a subsequent I/O operation fails.

> In this case, by the time the OS gets the notification,  
>it's too late.

If you think about a write cache on the hotplug device itself, then yes,
it is too late. For removable devices (and removable media) it might
be useful to disable (or significantly reduce) write caching.

The Amiga did flush the write cache after 2-3 seconds when the
device was idle, and we are talking about dozens of blocks and
not of write queues of a few Gigabytes where flushing takes
minutes.

When a write operation failed because the device (i.e. the medium)
was removed then you could still continue by reinserting the
medium, often you could even insert the medium into a different
device because the system tracked the medium by a volume identifier
and timestamp.

Removing a medium was also safe most of the time because the Amiga
didn't know about access timestamps but only modification timestamps,
reading a disk didn't cause write activity.


-- 
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."