Problem in reading data by generating an IRP

In my file system filter driver, I generate an IRP to read some data, with
the Irp->Flags = IRP_READ_OPERATION | IRP_PAGING_IO | IRP_NOCACHE |
IRP_SYNCHRONOUS_PAGING_IO

Sometimes a new IRP will be generated and pass through my filter driver
again if my read is the first read. It seems that the flag IRP_NOCACHE is
not working.

How can I want generate a read request to read data directly from the disk
without refering to the cache?

Look at IoSetTopLevelIrp() and the get counterpart. The first step is to
open a file and look at the request coming in from the cache manager. You
might want to compile a debug version of FastFat.sys and see how it handles
the first request and the subsequent IRPs that are generated by the cache
manager and sent to the file system. The easiest way to do this is the
debug version of FastFat since NTFS is not available.

The interactions between the cache manager, virtual memory manager, and file
systems are so intertwined that getting requests honored without the cache
manager being involved is almost impossible. You can tell the difference
between the requests being send by the cache manager and other sources. The
file systems use the cache manager to cache meta-data about the file
including directory blocks, etc.

Also don’t forget that the caching is sometimes controlled by the type of
IRP_MJ_CREATE that is seen. You might be causing a conflict with the file
system by doing a non-cached IO when the open requested caching.

----- Original Message -----
From: “Eric Chan”
To: “File Systems Developers”
Sent: Monday, August 12, 2002 10:14 PM
Subject: [ntfsd] Problem in reading data by generating an IRP

> In my file system filter driver, I generate an IRP to read some data, with
> the Irp->Flags = IRP_READ_OPERATION | IRP_PAGING_IO | IRP_NOCACHE |
> IRP_SYNCHRONOUS_PAGING_IO
>
> Sometimes a new IRP will be generated and pass through my filter driver
> again if my read is the first read. It seems that the flag IRP_NOCACHE is
> not working.
>
> How can I want generate a read request to read data directly from the disk
> without refering to the cache?
>
> —
> You are currently subscribed to ntfsd as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to %%email.unsub%%
>