Steven Scholz wrote:
Tejun,
How about recent kernels? Does sync() block until buffers are flushed?
How can I find out if the disk caches are actually flushed?
I want to make sure that all data is flushed to my disk drive
before powering down the system.
All disk caches are flushed before shutdown via the following path.
kernel/sys.c::sys_reboot()
kernel/drivers/base/power/shutdown.c::device_shutdown()
driver specific ->shutdown callback, for ide disks, the path is
drivers/ide/ide-disk.c::ide_device_shutdown()
drivers/ide/ide-disk.c::ide_cacheflush_p()
drivers/ide/ide-disk.c::do_idedisk_flushcache()
And, AFAIK, sync() doesn't flush disk caches.
How about umount?
[CC'ing Bartlomiej (Hi!)]
Hmmm, umount doesn't. I think maybe adding cache flushing to sync
and umount can be helpful.
Ehm. So you're saying umount does _not_ flush the disk caches? BUT it
will flush the the fs buffers, right?
Yeap, but it seems that currently ide-disk seems to flush only on
reboot not on halt. As soon as Bartlomiej confirms it, I'll submit a
patch or he'll fix it.
And one more thing, ide-disk doesn't flush cache when shutting down.
It flushes only when rebooting.
How about ide-cs then? When I unregister a drive?
ide-cs is low-level driver, it just registers ide device with upper
ide midlayer and ide-disk handles all the rest, so it's all the same there.
--
tejun
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html