FILE_FLAG_WRITE_THROUGH on Windows 2000

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

Are you using a SCSI disk? If so, is write back caching enabled or disabled
on the drive’s mode page? Do you have an Adaptec controller? If so, is the
controller’s BIOS set to enable or disable write back caching for that
drive? Are you using the same hardware for both the NT4 and W2K tests?

-----Original Message-----
From: Don A Richards [mailto:drichard@us.ibm.com]
Sent: Tuesday, March 20, 2001 5:18 PM
To: File Systems Developers
Subject: [ntfsd] FILE_FLAG_WRITE_THROUGH on Windows 2000

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: xxxxx@nsisw.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


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

Don,

My first guess would be that the files are compressed or encrypted. In such
a case, the NTFS file system does not honor the write-through (nor the
no-intermediate-buffering) option(s).

Regards,

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: Don A Richards [mailto:drichard@us.ibm.com]
Sent: Tuesday, March 20, 2001 5:18 PM
To: File Systems Developers
Subject: [ntfsd] FILE_FLAG_WRITE_THROUGH on Windows 2000

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: xxxxx@osr.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


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

The computer used for the NT and Windows 2000 tests was the same computer.
All hardware in both tests was identical except for the hard disk. The
tests were run by plugging one of the hard disks into the computer and
running the test on one OS, and then removing that hard disk and replacing
it with the other hard disk (using the same connector) and running the test
on the other OS.

The file is a normal flat file.

The NT hard disk is Quantum Fireball 6.4GB.
The Windows 2000 hard disk is Maxtor 9060D4.
The IDE controller is Intel(r)8237/AB/EB PCI IDE ATA/ATAPI controller

Configurable setting for the IDE controller was “Transfer Mode” with
options for “PIO only” and “DMA if available”. Write through did not seem
to be working on Windows 2000 with either setting.

Any ideas or suggestions?

Regards,

Don Richards

Tony Mason @lists.osr.com on 03/20/2001 05:59:29 PM

Please respond to “File Systems Developers”

Sent by: xxxxx@lists.osr.com

To: “File Systems Developers”
cc:
Subject: [ntfsd] RE: FILE_FLAG_WRITE_THROUGH on Windows 2000

Don,

My first guess would be that the files are compressed or encrypted. In
such
a case, the NTFS file system does not honor the write-through (nor the
no-intermediate-buffering) option(s).

Regards,

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: Don A Richards [mailto:drichard@us.ibm.com]
Sent: Tuesday, March 20, 2001 5:18 PM
To: File Systems Developers
Subject: [ntfsd] FILE_FLAG_WRITE_THROUGH on Windows 2000

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

I couldn’t find specs for a Maxtor 9060D4. Is the model number 90640D4
(DiamondMax 3400 Ultra ATA 6.4 GB?) If so, I found some information of
interest to you on the latter model in Maxtor’s Product Manual:

Write Cache Stacking
Normally, this mode is active. Write cache mode accepts the host write data
into the buffer until the buffer
is full or the host transfer is complete. A command complete interrupt is
generated at the end of the transfer.
A disk write task begins to store the host data to disk. Host write commands
continue to be accepted and
data transferred to the buffer until either the write command stack is full
or the data buffer is full. The drive
may reorder write commands to optimize drive throughput.

-----Original Message-----
From: Don A Richards [mailto:drichard@us.ibm.com]
Sent: Thursday, March 22, 2001 3:52 PM
To: File Systems Developers
Subject: [ntfsd] RE: FILE_FLAG_WRITE_THROUGH on Windows 2000

The computer used for the NT and Windows 2000 tests was the
same computer.
All hardware in both tests was identical except for the hard
disk. The
tests were run by plugging one of the hard disks into the computer and
running the test on one OS, and then removing that hard disk
and replacing
it with the other hard disk (using the same connector) and
running the test
on the other OS.

The file is a normal flat file.

The NT hard disk is Quantum Fireball 6.4GB.
The Windows 2000 hard disk is Maxtor 9060D4.
The IDE controller is Intel(r)8237/AB/EB PCI IDE ATA/ATAPI controller

Configurable setting for the IDE controller was “Transfer Mode” with
options for “PIO only” and “DMA if available”. Write through
did not seem
to be working on Windows 2000 with either setting.

Any ideas or suggestions?

Regards,

Don Richards

Tony Mason @lists.osr.com on 03/20/2001 05:59:29 PM
>
> Please respond to “File Systems Developers”
>
> Sent by: xxxxx@lists.osr.com
>
>
> To: “File Systems Developers”
> cc:
> Subject: [ntfsd] RE: FILE_FLAG_WRITE_THROUGH on Windows 2000
>
>
>
> Don,
>
> My first guess would be that the files are compressed or
> encrypted. In
> such
> a case, the NTFS file system does not honor the write-through (nor the
> no-intermediate-buffering) option(s).
>
> Regards,
>
> Tony Mason
> Consulting Partner
> OSR Open Systems Resources, Inc.
> http://www.osr.com
>
>
> -----Original Message-----
> From: Don A Richards [mailto:drichard@us.ibm.com]
> Sent: Tuesday, March 20, 2001 5:18 PM
> To: File Systems Developers
> Subject: [ntfsd] FILE_FLAG_WRITE_THROUGH on Windows 2000
>
>
> 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: xxxxx@nsisw.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


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

There is SL_WRITE_THROUGH flag in the IO_STACK_LOCATION.
The filesystems use it to implement uncached writes.
NTFS uses it for all fault-tolerance-related metadata writes.
Disk.sys interprets SL_WRITE_THROUGH by setting the “force media access”
flag in the SCSI CDB.

This must work as desired on any SCSI drive, but as about the ATA ones… I
have doubts that ATAPI.SYS maps SCSI-like “force media access” to ATA
primitive on disabling the cache. The old NT4 ATAPI.SYS (the DDK source)
seems to ignore this CDB flag.
So, uncached writes on ATA drives are the open question.

Max

----- Original Message -----
From: “Rob Fuller”
To: “File Systems Developers”
Sent: Friday, March 23, 2001 3:01 AM
Subject: [ntfsd] RE: FILE_FLAG_WRITE_THROUGH on Windows 2000

> I couldn’t find specs for a Maxtor 9060D4. Is the model number 90640D4
> (DiamondMax 3400 Ultra ATA 6.4 GB?) If so, I found some information of
> interest to you on the latter model in Maxtor’s Product Manual:
>
> Write Cache Stacking
> Normally, this mode is active. Write cache mode accepts the host write
data
> into the buffer until the buffer
> is full or the host transfer is complete. A command complete interrupt is
> generated at the end of the transfer.
> A disk write task begins to store the host data to disk. Host write
commands
> continue to be accepted and
> data transferred to the buffer until either the write command stack is
full
> or the data buffer is full. The drive
> may reorder write commands to optimize drive throughput.
>
> > -----Original Message-----
> > From: Don A Richards [mailto:drichard@us.ibm.com]
> > Sent: Thursday, March 22, 2001 3:52 PM
> > To: File Systems Developers
> > Subject: [ntfsd] RE: FILE_FLAG_WRITE_THROUGH on Windows 2000
> >
> >
> > The computer used for the NT and Windows 2000 tests was the
> > same computer.
> > All hardware in both tests was identical except for the hard
> > disk. The
> > tests were run by plugging one of the hard disks into the computer and
> > running the test on one OS, and then removing that hard disk
> > and replacing
> > it with the other hard disk (using the same connector) and
> > running the test
> > on the other OS.
> >
> > The file is a normal flat file.
> >
> > The NT hard disk is Quantum Fireball 6.4GB.
> > The Windows 2000 hard disk is Maxtor 9060D4.
> > The IDE controller is Intel(r)8237/AB/EB PCI IDE ATA/ATAPI controller
> >
> > Configurable setting for the IDE controller was “Transfer Mode” with
> > options for “PIO only” and “DMA if available”. Write through
> > did not seem
> > to be working on Windows 2000 with either setting.
> >
> > Any ideas or suggestions?
> >
> >
> >
> > Regards,
> >
> > Don Richards
> >
> >
> >
> >
> >
> > Tony Mason @lists.osr.com on 03/20/2001 05:59:29 PM
> >
> > Please respond to “File Systems Developers”
> >
> > Sent by: xxxxx@lists.osr.com
> >
> >
> > To: “File Systems Developers”
> > cc:
> > Subject: [ntfsd] RE: FILE_FLAG_WRITE_THROUGH on Windows 2000
> >
> >
> >
> > Don,
> >
> > My first guess would be that the files are compressed or
> > encrypted. In
> > such
> > a case, the NTFS file system does not honor the write-through (nor the
> > no-intermediate-buffering) option(s).
> >
> > Regards,
> >
> > Tony Mason
> > Consulting Partner
> > OSR Open Systems Resources, Inc.
> > http://www.osr.com
> >
> >
> > -----Original Message-----
> > From: Don A Richards [mailto:drichard@us.ibm.com]
> > Sent: Tuesday, March 20, 2001 5:18 PM
> > To: File Systems Developers
> > Subject: [ntfsd] FILE_FLAG_WRITE_THROUGH on Windows 2000
> >
> >
> > 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: xxxxx@nsisw.com
> > To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


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