how to disable read/write cache

I need to figure out how to disable read and write caching for a volume for
Windows 2000/XP.

We a have a device driver that makes a virtual drive, and then transfers the
data for this virtual drive through a parallel port to another machine. It
is a FAT16 drive. I am hoping there is some setting in the file system that
will let us turn the caching off.

Any suggestions would be appreciated.

Diane

Because of the cache manager/file system design of Windows 2000 and XP,
the file systems cannot operation without the system cache enabled.
They use the system cache to access their metadata.

Why exactly do you need to disable the system cache for your design?
Maybe there is another way to solve the problem.

Molly Brown
Microsoft Corporation

This posting is provided “AS IS” with no warranties and confers no
rights.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of DianeRose
Sent: Friday, December 05, 2003 3:34 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] how to disable read/write cache

I need to figure out how to disable read and write caching for a volume
for Windows 2000/XP.

We a have a device driver that makes a virtual drive, and then transfers
the data for this virtual drive through a parallel port to another
machine. It is a FAT16 drive. I am hoping there is some setting in the
file system that will let us turn the caching off.

Any suggestions would be appreciated.

Diane


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

There are a couple of problems we are running into. The first is regarding
the write cache. It looks like the system caches the writes and then
eventually sends them to our device. The application from user mode thinks
the write has succeeded, even though it has not been completed by our driver
yet. If our connection to the remote machine is interrupted (say the
connecting cable is removed) then we get a hard error notifying the user
program that the write failed, and the data has been lost.

Another problem is that we don’t have control over

“Molly Brown” wrote in message
news:xxxxx@ntfsd…

Because of the cache manager/file system design of Windows 2000 and XP,
the file systems cannot operation without the system cache enabled.
They use the system cache to access their metadata.

Why exactly do you need to disable the system cache for your design?
Maybe there is another way to solve the problem.

Molly Brown
Microsoft Corporation

This posting is provided “AS IS” with no warranties and confers no
rights.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of DianeRose
Sent: Friday, December 05, 2003 3:34 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] how to disable read/write cache

I need to figure out how to disable read and write caching for a volume
for Windows 2000/XP.

We a have a device driver that makes a virtual drive, and then transfers
the data for this virtual drive through a parallel port to another
machine. It is a FAT16 drive. I am hoping there is some setting in the
file system that will let us turn the caching off.

Any suggestions would be appreciated.

Diane


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Oops … this is the second half of that last post

Another problem is that we don’t have control over over what read IRPs are
coming in. For example, the cache manager does a nice job of remembering a
directory after we have done a “dir” on the virtual device. But how to we
tell the cache manager that the data has changed - maybe the connection has
been dropped - when there is no IRP being sent to the driver?

Diane

“Molly Brown” wrote in message
> news:xxxxx@ntfsd…
>
> Because of the cache manager/file system design of Windows 2000 and XP,
> the file systems cannot operation without the system cache enabled.
> They use the system cache to access their metadata.
>
> Why exactly do you need to disable the system cache for your design?
> Maybe there is another way to solve the problem.
>
> Molly Brown
> Microsoft Corporation
>
> This posting is provided “AS IS” with no warranties and confers no
> rights.
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of DianeRose
> Sent: Friday, December 05, 2003 3:34 PM
> To: Windows File Systems Devs Interest List
> Subject: [ntfsd] how to disable read/write cache
>
> I need to figure out how to disable read and write caching for a volume
> for Windows 2000/XP.
>
> We a have a device driver that makes a virtual drive, and then transfers
> the data for this virtual drive through a parallel port to another
> machine. It is a FAT16 drive. I am hoping there is some setting in the
> file system that will let us turn the caching off.
>
> Any suggestions would be appreciated.
>
> Diane
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>

Ahh, you seem to need a SAN alike FS, not a cache disable.
But probably a cache PURGE would work for you.

DianeRose wrote:

Oops … this is the second half of that last post

Another problem is that we don’t have control over over what read IRPs are
coming in. For example, the cache manager does a nice job of remembering a
directory after we have done a “dir” on the virtual device. But how to we
tell the cache manager that the data has changed - maybe the connection has
been dropped - when there is no IRP being sent to the driver?

Diane

> “Molly Brown” wrote in message
> > news:xxxxx@ntfsd…
> >
> > Because of the cache manager/file system design of Windows 2000 and XP,
> > the file systems cannot operation without the system cache enabled.
> > They use the system cache to access their metadata.
> >
> > Why exactly do you need to disable the system cache for your design?
> > Maybe there is another way to solve the problem.
> >
> > Molly Brown
> > Microsoft Corporation
> >
> > This posting is provided “AS IS” with no warranties and confers no
> > rights.
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of DianeRose
> > Sent: Friday, December 05, 2003 3:34 PM
> > To: Windows File Systems Devs Interest List
> > Subject: [ntfsd] how to disable read/write cache
> >
> > I need to figure out how to disable read and write caching for a volume
> > for Windows 2000/XP.
> >
> > We a have a device driver that makes a virtual drive, and then transfers
> > the data for this virtual drive through a parallel port to another
> > machine. It is a FAT16 drive. I am hoping there is some setting in the
> > file system that will let us turn the caching off.
> >
> > Any suggestions would be appreciated.
> >
> > Diane
> >
> >
> >
> > —
> > Questions? First check the IFS FAQ at
> > https://www.osronline.com/article.cfm?id=17
> >
> > You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> >
>
> —
> Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@alfasp.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Kind regards, Dejan M. MVP for DDK
http://www.alfasp.com E-mail: xxxxx@alfasp.com
Alfa Transparent File Encryptor - Transparent file encryption services.
Alfa File Protector - File protection and hiding library for Win32 developers.
Alfa File Monitor - File monitoring library for Win32 developers.

> yet. If our connection to the remote machine is interrupted (say the

connecting cable is removed) then we get a hard error notifying the user
program that the write failed, and the data has been lost.

This is unsolvable in Windows, and thus the tray icon to eject the USB flashes.
You can re-use the same functionality though.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Can you please explain? I don’t know much about file systems. (I’m
assuming that is were these are.)
Diane

“Dejan Maksimovic” wrote in message news:xxxxx@ntfsd…
>
>
> Ahh, you seem to need a SAN alike FS, not a cache disable.
> But probably a cache PURGE would work for you.
>
> DianeRose wrote:
>
> > Oops … this is the second half of that last post
> >
> > Another problem is that we don’t have control over over what read IRPs
are
> > coming in. For example, the cache manager does a nice job of
remembering a
> > directory after we have done a “dir” on the virtual device. But how to
we
> > tell the cache manager that the data has changed - maybe the connection
has
> > been dropped - when there is no IRP being sent to the driver?
> >
> > Diane
> >
> > > “Molly Brown” wrote in message
> > > news:xxxxx@ntfsd…
> > >
> > > Because of the cache manager/file system design of Windows 2000 and
XP,
> > > the file systems cannot operation without the system cache enabled.
> > > They use the system cache to access their metadata.
> > >
> > > Why exactly do you need to disable the system cache for your design?
> > > Maybe there is another way to solve the problem.
> > >
> > > Molly Brown
> > > Microsoft Corporation
> > >
> > > This posting is provided “AS IS” with no warranties and confers no
> > > rights.
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of DianeRose
> > > Sent: Friday, December 05, 2003 3:34 PM
> > > To: Windows File Systems Devs Interest List
> > > Subject: [ntfsd] how to disable read/write cache
> > >
> > > I need to figure out how to disable read and write caching for a
volume
> > > for Windows 2000/XP.
> > >
> > > We a have a device driver that makes a virtual drive, and then
transfers
> > > the data for this virtual drive through a parallel port to another
> > > machine. It is a FAT16 drive. I am hoping there is some setting in
the
> > > file system that will let us turn the caching off.
> > >
> > > Any suggestions would be appreciated.
> > >
> > > Diane
> > >
> > >
> > >
> > > —
> > > Questions? First check the IFS FAQ at
> > > https://www.osronline.com/article.cfm?id=17
> > >
> > > You are currently subscribed to ntfsd as:
xxxxx@windows.microsoft.com
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >
> > >
> > >
> >
> > —
> > Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
> >
> > You are currently subscribed to ntfsd as: xxxxx@alfasp.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> –
> Kind regards, Dejan M. MVP for DDK
> http://www.alfasp.com E-mail: xxxxx@alfasp.com
> Alfa Transparent File Encryptor - Transparent file encryption services.
> Alfa File Protector - File protection and hiding library for Win32
developers.
> Alfa File Monitor - File monitoring library for Win32 developers.
>
>
>
>

If this is unsolvable, that is very bad news. By re-using the
functionality, are you referring to the way the system handles removal of a
USB cable or something else? We are not using USB. We really need to find
a way for this to be handled smoothly when a write fails at our device
driver level.

Diane

“Maxim S. Shatskih” wrote in message
news:xxxxx@ntfsd…
>
> > yet. If our connection to the remote machine is interrupted (say the
> > connecting cable is removed) then we get a hard error notifying the user
> > program that the write failed, and the data has been lost.
>
> This is unsolvable in Windows, and thus the tray icon to eject the USB
flashes.
> You can re-use the same functionality though.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
>

By remounting the volume, surely.

Your disk driver must signal the media removal to upper layers, then
respond to verification read with the volume serial number “spoiled” in the
boot block. In this case, the FSD will think this is new volume, and thus
remount.

I have tried several other ways, and all were unreliable. The way described
below passed the heavy 24hours testing (around 100.000 mount/unmount
operations).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “DianeRose”
Newsgroups: ntfsd
To: “Windows File Systems Devs Interest List”
Sent: Saturday, December 06, 2003 6:18 AM
Subject: [ntfsd] Re: how to disable read/write cache

> Oops … this is the second half of that last post
>
> Another problem is that we don’t have control over over what read IRPs are
> coming in. For example, the cache manager does a nice job of remembering a
> directory after we have done a “dir” on the virtual device. But how to we
> tell the cache manager that the data has changed - maybe the connection has
> been dropped - when there is no IRP being sent to the driver?
>
> Diane
>
> > “Molly Brown” wrote in message
> > news:xxxxx@ntfsd…
> >
> > Because of the cache manager/file system design of Windows 2000 and XP,
> > the file systems cannot operation without the system cache enabled.
> > They use the system cache to access their metadata.
> >
> > Why exactly do you need to disable the system cache for your design?
> > Maybe there is another way to solve the problem.
> >
> > Molly Brown
> > Microsoft Corporation
> >
> > This posting is provided “AS IS” with no warranties and confers no
> > rights.
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of DianeRose
> > Sent: Friday, December 05, 2003 3:34 PM
> > To: Windows File Systems Devs Interest List
> > Subject: [ntfsd] how to disable read/write cache
> >
> > I need to figure out how to disable read and write caching for a volume
> > for Windows 2000/XP.
> >
> > We a have a device driver that makes a virtual drive, and then transfers
> > the data for this virtual drive through a parallel port to another
> > machine. It is a FAT16 drive. I am hoping there is some setting in the
> > file system that will let us turn the caching off.
> >
> > Any suggestions would be appreciated.
> >
> > Diane
> >
> >
> >
> > —
> > Questions? First check the IFS FAQ at
> > https://www.osronline.com/article.cfm?id=17
> >
> > You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> >
>
>
>
> —
> Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

You can mandate the user to press the “Stop” button before removal, like
USB flashes do. This is the maximum you can do. You cannot force the FS to use
no caching :slight_smile:

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “DianeRose”
Newsgroups: ntfsd
To: “Windows File Systems Devs Interest List”
Sent: Saturday, December 06, 2003 9:42 PM
Subject: [ntfsd] Re: how to disable read/write cache

> If this is unsolvable, that is very bad news. By re-using the
> functionality, are you referring to the way the system handles removal of a
> USB cable or something else? We are not using USB. We really need to find
> a way for this to be handled smoothly when a write fails at our device
> driver level.
>
> Diane
>
> “Maxim S. Shatskih” wrote in message
> news:xxxxx@ntfsd…
> >
> > > yet. If our connection to the remote machine is interrupted (say the
> > > connecting cable is removed) then we get a hard error notifying the user
> > > program that the write failed, and the data has been lost.
> >
> > This is unsolvable in Windows, and thus the tray icon to eject the USB
> flashes.
> > You can re-use the same functionality though.
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> >
> >
>
>
>
> —
> Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

I guess from the number of messages this must be important to you. You need
to understand the file systems and storage stack in Windows 2000 and XP,
which do differ in some significant degrees in the area that concerns you.

  1. Windows 2000 is very bad at keeping file systems on storage devices up
    to date and coherent. Copying many files to a USB flash memory device will
    run very well for some period of time and then the activity will seem to
    stop. Now, go ahead and remove the flash memory and analyze it - scrambled
    and useless. You will probably get a data lost message from the computer
    where you had it inserted before. You must wait at least one minute after
    all activity. You can also use Windows Explorer to ‘eject’ the media and
    that will work to flush all dirty buffers. In a program you can lock the
    volume exclusive which will also flush any dirty buffers.

  2. Windows XP has an option for media that is marked as ‘removable’ or
    devices that indicate they are a ‘removable device’. A standard floppy is
    ‘removable media’ while a USB hard drive is a ‘removable device’ and a USB
    flash memory reader is both. There is a property page that allows
    ‘removable media’ to be treated as ‘Optimize for performance’ or ‘Optimize
    for quick removal’. ‘removable devices’ also have a ‘Enable write caching
    on the disk’ option if ‘Optimize for performance’ is chosen. Choosing
    ‘Optimize for quick removal’ is probably the best solution to keeping the
    remote media updated. Stupid users will find a way to scramble the data no
    matter what you do.

If the above options don’t work: Use XP’s options to keep window of
vulnerability to the minimum, write a program that looks for minimal
activity on the device and forces a flush, write applications using your
device to open all files in unbuffered/uncached mode.

Then try: writing your own file system but make sure it is not the same as
FAT. Microsoft has began to charge royalties for use of FAT.

From some of the posts, you may need to hire someone to help you. 500kbps
parallel port vice 12mbps for USB 1.1 is an interesting choice. I used to
work on the FlashPath where data transfer was about 300kbps +/- 10%. As the
flash memory sizes increased and USB device prices dropped, it became futile
to continue at those speeds.

“DianeRose” wrote in message
news:xxxxx@ntfsd…
>
> I need to figure out how to disable read and write caching for a volume
for
> Windows 2000/XP.
>
> We a have a device driver that makes a virtual drive, and then transfers
the
> data for this virtual drive through a parallel port to another machine.
It
> is a FAT16 drive. I am hoping there is some setting in the file system
that
> will let us turn the caching off.
>
> Any suggestions would be appreciated.
>
> Diane
>
>
>
>

If you’re not a programmer, whatever I say would be of little use.
It is possible to do a directory cache purge (thought I’m not really sure how, I
know I’ve done it in a file system, but since you’d be using a default file system
(FAT or NTFS) you’d need to do it in a filter)

DianeRose wrote:

Can you please explain? I don’t know much about file systems. (I’m
assuming that is were these are.)


Kind regards, Dejan M. MVP for DDK
http://www.alfasp.com E-mail: xxxxx@alfasp.com
Alfa Transparent File Encryptor - Transparent file encryption services.
Alfa File Protector - File protection and hiding library for Win32 developers.
Alfa File Monitor - File monitoring library for Win32 developers.

> Then try: writing your own file system but make sure

it is not the same as FAT. Microsoft has began to
charge royalties for use of FAT.

I think that’s inaccurate. I believe Microsoft is offering royalties on

  1. its own implementation of FAT, and 2) licensing for its FAT-specific
    patents (IP), which mostly cover long filename support and a few other
    extensions.

FAT’s out of the bag. It’s been documented for so long, and implemented
on soooo many platforms, that I think it sort of counts as its own prior
art. I am not a lawyer of course, nor do I speak for Microsoft. But I
wouldn’t discard FAT just yet – at least not until there is a consensus
on what Microsoft’s recently-announced FAT licensing actually means.

– arlie

Microsoft’s recent announcement means whatever they want it to mean unless
you have several million dollars to fight them. That it is limited to
$250,000 for a ‘license’ would make it cheaper to pay it instead of the
lawyers. It does not say you will be given source code to FAT, but only
that you can use it. I did note the patents cited are mostly for the LFN
support added with Windows 95 and Windows 2000. Some of the examples are
those of flash memory devices that contain a FAT file system. The cameras I
have seen only use 8.3 formatted names, but I am sure some of the new MP3
players use LFNs for display. FAT is a very old variation of CPM’s file
system where the file blocks have a link to the next directory entry that
shows where the next data block is located. That was inefficient for large
files and when checking for lost allocation units. I did not see a basic
FAT patent at the USPTO.

I suggested avoiding using FAT just to save all the legal fees. You could
just use ext2 and have a lot of examples you can examine. Maybe even try
the CPM file system since it is far too old to patent and if it was, they
should have expired. With a parallel port connection, speed is not a
consideration.

As to what the license means, I think it means that Japan Inc.'s recent
attempt to use Linux for some consumer devices made M$ unhappy. I think
Japan Inc. is looking for a new OS for phones and other devices, too. I
hear China likes to avoid patent payments which is why VCD is so popular and
DVDs are not.

This is sure fun!

“Arlie Davis” wrote in message news:xxxxx@ntfsd…
>
> > Then try: writing your own file system but make sure
> > it is not the same as FAT. Microsoft has began to
> > charge royalties for use of FAT.
>
> I think that’s inaccurate. I believe Microsoft is offering royalties on
> 1) its own implementation of FAT, and 2) licensing for its FAT-specific
> patents (IP), which mostly cover long filename support and a few other
> extensions.
>
> FAT’s out of the bag. It’s been documented for so long, and implemented
> on soooo many platforms, that I think it sort of counts as its own prior
> art. I am not a lawyer of course, nor do I speak for Microsoft. But I
> wouldn’t discard FAT just yet – at least not until there is a consensus
> on what Microsoft’s recently-announced FAT licensing actually means.
>
> – arlie
>
>
>

> Microsoft’s recent announcement means whatever they want it to

mean unless you have several million dollars to fight them.

Yeah, agreed. That’s why I said “not until there is a consensus on what
Microsoft’s … licensing actually means.”

– arlie