Re: Write-through the hard disk cache to persistent media (+)
- From: "Alexander Grigoriev" <alegr@xxxxxxxxxxxxx>
- Date: Fri, 19 Oct 2007 06:38:31 -0700
SATA drives don't support per-request write through flag. Only SCSI drives
do that. Fot ATA/SATA you can only disable it completely.
"Mejedi" <Mejedi@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D11471E3-54EA-4492-8DB5-4612AB9E37E1@xxxxxxxxxxxxxxxx
Is there a reliable method to ensure that data is commited to physical
media
when writing files?
MSDN says:
CreateFile
FILE_FLAG_WRITE_THROUGH
Instructs the system to write through any intermediate cache and go
directly to disk.
If FILE_FLAG_NO_BUFFERING is not also specified, so that system caching
is in effect,
then the data is written to the system cache, but is flushed to disk
without delay.
If FILE_FLAG_NO_BUFFERING is also specified, so that system caching is
not in effect,
then the data is immediately flushed to disk without going through the
system cache.
The operating system also requests a write-through the hard disk cache to
persistent
media. However, not all hardware supports this write-through capability.
I try to get the described behaviour (i.e. FFNB|FFWT to ensure data is
actually stored on plates) but something strange happens. I have a small
test
program that writes a preallocated contigous 100MB file (the same file for
all runs) in 32KB blocks sequentially and collects timing data with
QPF+QPC.
IO is done synchronously, OS is WinXP Sp2, using 7200 RPM SATA WD drive.
If write caching is enabled I get these results (timing in microsecs).
They
don't change whether FFWT flag is set or not.
631
551
581
744
655
538
560
558
668
556
835
544
546
553
503
512
507
...
If write caching is disabled (with a checkbox in Control Panel) I get
these
results. Again nothing changes when FFWT is set.
13211
8754
8701
9023
8562
8763
8777
8789
8736
8787
8782
8782
8784
8788
8779
8749
8768
...
I expect to get the results similar to second ones when running with write
cache enabled and oppening file with FFWT|FFNB. I guess that timing ways
less
than rotational delay witnesses that no write-through HDD cache actually
happens.
Is there a reliable method to ensure that data is commited to physical
media
when writing files?
.
- Follow-Ups:
- References:
- Prev by Date: Re: EnterCriticalSection
- Next by Date: Re: MsgWaitForMultipleObjects - The Saga Continues...
- Previous by thread: Write-through the hard disk cache to persistent media (+)
- Next by thread: Re: Write-through the hard disk cache to persistent media (+)
- Index(es):
Relevant Pages
|
Loading