On Windows 2000, it appears that Windows is returning from the WriteFile()
API before the data is written to the disk even when
FILE_FLAG_WRITE_THROUGH is set on the CreateFile(). Is anyone aware of any
problems with FILE_FLAG_WRITE_THROUGH on Win2k or able to provide any
insight into the results described below?
I’m using the NTFS file system and writing to a local fixed disk. I’m
using files on disk to record state information and ping pong between two
sets of files with each update to assure one set is always consistent. The
following paragraph describes in detail a program I use to quickly test
ping ponging between two sets of state files during loss of power (and
please don’t suggest just using a UPS…I have to deal with “untrained”
users that sometimes hit the power-off button).
The computer is powered off while a test program runs the following code.
When the machine is powered back on, it is expected that the data in one
set of the three files will match (either set 1,2,3 or 4,5,6). On
Windows 2000, the data in the files in each set can be a few hundred off
(i.e. file 1 can be 100+ off compared to file 2 at the same time file 4 is
100+ off compared to file 5). On Windows NT, using the same test program
on the same computer, the test works as expected with either file set 1,2,3
or 4,5,6 all having the same number. Disk caching at the BIOS level is
turned off.
pseudocode (small files are 8192 bytes; large files are 50,000 bytes)
i = 1;
create file with FILE_FLAG_WRITE_THROUGH flag
while (true) {
write i to the beginning and end of the set of three files-- small1,
small2, large3
increment i
write i to the beginning and end of each of the other set of three files
– small4, small5, large 6
increment i
}
Regards,
Don Richards
You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com