Tejun Heo wrote:

Steven Scholz wrote:

Hi there,

According to an (old) man page of sync(2)

       According to  the  standard  specification  (e.g.,  SVID),
       sync()  schedules  the  writes,  but may return before the
       actual writing is done.   However,  since  version  1.3.20
       Linux  does actually wait.  (This still does not guarantee
       data integrity: modern disks have large caches.)

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.

Thanks.


 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?

--
Steven




--
Steven Scholz

imc Measurement & Control               imc Meßsysteme GmbH
Voltastr. 5                             Voltastr. 5
13355 Berlin                            13355 Berlin
Germany                                 Deutschland
-
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

Reply via email to