On 08/20/2011 04:41 AM, Earl Pottinger wrote:
One minor problem with my driver is flushing the contents of the RAMDISK to storage. Presently, I solve problem by calling my flush() every three seconds or so.
As Ingo already pointed out in an earlier mail, it really sounds as if your RAMDISK is just a poor man's cache, and as such completely superfluous, and extremely counter productive on Haiku.
What I really want to do is to flush the contents when the driver is unloaded/shutdown. The uninit_driver() should serve this purpose, but in my tests this call is taken least than 1-in-20 times whenever I select Haiku's shutdown command. This causes a problem because while the BFS ioctl() passes my code a flush request, some writes() will occur that flush request. If I do not
That should really not happen. Can you identify what exactly is still trying to write?
force a flush() after those final writes() the resulting drive image is not a valid one or is missing the last files written to it when I reboot and reload the resulting drive image to memory. Any suggestions in how to insure uninit_driver() is always called after Haiku-OS starts a shutdown?
The word you were looking for is probably "ensure", BTW. Besides that, there currently is no such mechanism for this. The shutdown mechanism is currently very (read: too) simplistic: it just kills all teams left, and then sync()s. It doesn't even wait for all teams to be dead, and only even kills anything when rebooting.
Patches welcome. Bye, Axel.