The function of the IRP_NOCACHE bit is to indicate that you should NOT
retrieve the data from the cache. If you are satisfying a paging I/O
operation, you can’t retrieve it from the cache - since if it were in the
cache, you wouldn’t be getting the paging I/O request at all.
The valid combinations here would be:
Neither bit set - normal user read/write request
Both bits set - normal paging I/O request
No-cache set, paging I/O clear - non-cached user read/write request
The fourth combination (paging I/O set, no-cache clear) would be invalid.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: James Dunning [mailto:xxxxx@generaldynamics.uk.com]
Sent: Tuesday, July 16, 2002 7:31 AM
To: File Systems Developers
Subject: [ntfsd] Re: Having problems getting CcMapData to work!..
Hi Dan,
I would just like to quickly make sure that i have understood you
correctly…
In the previous reply, you mentioned that i should properly handle
IRP_MJ_READ, with Irp->Flags IRP_NOCACHE|IRP_PAGING_IO in my file system, in
order to satisfy ANY inpage operations.
Now if i use CcMapData, should the following flags IRP_NOCACHE (true) and
IRP_PAGING_IO (true) be set within the IRP_MJ_READ dispatch routine?
BOOLEAN PagingIo = BooleanFlagOn(Irp->Flags, IRP_PAGING_IO);
BOOLEAN NonCachedIo = BooleanFlagOn(Irp->Flags,IRP_NOCACHE);
The reason why i ask is because im getting confused why NonCacheIo should be
set to true, if CcMapData is one of the IFS cache routines. Surely that
NonCacheIo should be set to FALSE and PagingIo should be set to TRUE?
Regards,
James
-----Original Message-----
From: Dan Partelly [mailto:xxxxx@rdsor.ro]
Sent: 15 July 2002 15:55
To: File Systems Developers
Subject: [ntfsd] Re: Having problems getting CcMapData to work!..
> I just assumed that CcMapData called the device below the fs and did all
the work for me!
Assumption is mother of all f…ups. Besides , how could Cc manager know
which sectors to read from the
storage stack ? This is FS business. Maybe you should read a little more
about file systems, Cc manager and
brothers. Try Rajeev Nagar’s book.
“James Dunning” wrote in message
news:xxxxx@ntfsd…
>
> Ohhh Right! thats great cheers… I didnt realise that the IRP_MJ_READ and
i
> guess the IRP_MJ_CLEANUP needed to be implemented within the file system
and
> with the support for paging IO!
>
> I have quickly placed some breakpoints with in the fsdDispatch routine,
and
> i have noticed that when CcMapData is called, an IRP_MJ_READ request is
> generated, but the routine to handle the IRP_MJ_READ has been gutted… i
> guess i have over gutted the filesystem! lol! nevermind, i guess i can add
> the routines back as and when i require them! I just assumed that
CcMapData
> called the device below the fs and did all the work for me!
>
> Thanks again for your help.
>
> James
>
> -----Original Message-----
> From: Dan Partelly [mailto:xxxxx@rdsor.ro]
> Sent: 15 July 2002 14:55
> To: File Systems Developers
> Subject: [ntfsd] Re: Having problems getting CcMapData to work!..
>
>
> If your FS driver is not prepared to bring data back from secondary
sotrage
> (you should properly handle
> IRP_MJ_READ , with Irp->Flags IRP_NOCACHE | IRP_PAGING_IO ) your file
> system will not be able
> to satisfy ANY inpage operations. That means, no cache support and no
memory
> mapped files support.
> Donno if you handle this situation properly so far, for you say you
started
> with FsControl IRP. But if you build it upon an already made skeleton ,
> maybe you have it … Check if you do support paging IO properly in your
> file system. This support must be functional and up before you attmept to
> use the Cc.
>
> Dan
>
>
>
>
>
>
>
> ----- Original Message -----
> From: “James Dunning”
> To: “File Systems Developers”
> Sent: Monday, July 15, 2002 4:45 PM
> Subject: [ntfsd] Re: Having problems getting CcMapData to work!..
>
>
> > Thanks again for the response!
> >
> > Unfortunately i am still stumped as to why the CcMapData is throwing a
> > STATUS_IN_PAGE_ERROR. So I think would be best if i tried to explain
what
> i
> > am trying to do.
> >
> > I am currently writing a file system driver for a very simple file
system,
> > and up until now i have been gutting the cdfs file system which came
with
> > the Windows XP IFS kit. I am at a stage where i can now implement the
IRP
> > dispatch routines which are required for my file system, I have decided
to
> > start on the IRP_MJ_FILE_SYSTEM_CONTROL and implement the
> > IRP_MN_MOUNT_VOLUME request.
> >
> > Now i would like to use the Cache Manager here so i can cache the
volume’s
> > on disk structures. the primary volume block resides at block 1, which
is
> > only 64 bytes. I have used InitializeVcb to set up a new stream
> > VirualVolume file object by calling IoCreateStreamFileObject and then
> called
> > ccInitializeCacheMap, configuring the cache map filesize to 64 bytes.
> >
> > Now correct me if i am wrong, now that i have intialized the cache, i
> should
> > be able to call CcMapData which should page in the data from the disk?
> >
> > As far as i am aware the hdd doesnt have any bad sectors, and has been
> > partitioned with 1 formatted partition with the necessary on disk
> structures
> > for my filesystem to pick up and identify. Incidentally I have managed
to
> > read the on disk structures without the aid of the cache manager…
> >
> > Regards
> > James
> >
> > Ps. here’s a few snippets from my code…
> >
> > // the following code is in the InitializeVcb routine called from
> > MountVolume…
> >
> > RealDevice = Vcb->CurrentDevice;
> >
> > Vcb->VirtualVolumeFile = UnwindFileObject =
> > IoCreateStreamFileObject( NULL, RealDevice );
> >
> > StSetFileObject( Vcb->VirtualVolumeFile,
> > VirtualVolumeFile,
> > Vcb,
> > NULL );
> >
> > Vcb->VirtualVolumeFile->SectionObjectPointer =
> > &Vcb->SectionObjectPointers;
> >
> > Vcb->VirtualVolumeFile->ReadAccess = TRUE;
> > Vcb->VirtualVolumeFile->WriteAccess = TRUE;
> > Vcb->VirtualVolumeFile->DeleteAccess = TRUE;
> >
> > FileSizes.AllocationSize.QuadPart =
> > FileSizes.FileSize.QuadPart = sizeof(DIRECTORY_BLOCK_FORMAT);
> > FileSizes.ValidDataLength = StMaxLarge;
> >
> > CcInitializeCacheMap( Vcb->VirtualVolumeFile,
> > &FileSizes,
> > TRUE,
> > &StData.CacheManagerNoOpCallbacks,
> > Vcb );
> >
> > // this is in the MountVolume routine
> > try {
> > StReadVolumeFile( IrpContext,
> > Vcb,
> > 0, // Starting Byte
> > sizeof(DIRECTORY_BLOCK_FORMAT), // byte
> > count
> > &VolumeBcb,
> > (PVOID *)&VolumeBlock );
> >
> > } except(EXCEPTION_EXECUTE_HANDLER) {
> > ExceptionCode = GetExceptionCode();
> > }
> >
> >
> > // this is basically called from within the StReadVolumeFile routine…
> >
> > CcMapData( Vcb->VirtualVolumeFile,
> > &Vbo, // starting byte
> > ByteCount, // byte count
> > BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT),
> > Bcb, // ref to volume Bcb
> > Buffer ) // ref to volume Block
> >
> >
> >
> > -----Original Message-----
> > From: Dan Partelly [mailto:xxxxx@rdsor.ro]
> > Sent: 12 July 2002 12:39
> > To: File Systems Developers
> > Subject: [ntfsd] Re: Having problems getting CcMapData to work!..
> >
> >
> > STATUS_IN_PAGE_ERROR is returned in the case the page fault handler was
> not
> > able to read a swaped out memory page from the secondary storage. This
can
> > be the result of a many causes , such as:
> >
> > 1. Malfunctioning HW , like bad sectors on your HDD
> > 2. If you write a file system filter, check the paging IO path and make
> sure
> > the logic is error free.
> > 3. If you write a file system, make sure you handle corectly paging IO
> logic
> > for both paging files, and memory mapped files.
> > For memory mapped files , unless the view is mapped aginst a section
> backed
> > by a system pagingfile, the inpage operations will take place directly
> from
> > the file backing up the section.
> >
> > 4. If you have your own filters on the storage stack, or you have your
own
> > scsi miniports in the storage path, make sure
> > they are corectly written.
> >
> > However , it should be easy to isolate the cause.
> >
> > As a general rule , when you work with the cache manager, be aware that
> > almost all Cc functions can raise exceptions
> > on error conditions, altough this behaviour is not documented. The
status
> > codes returned are very valuable information
> > to see what went wrong. Keep this in mind when you code with Cc, and
adopt
> > defensive programming tactics. Employ
> > SEH to handle this kind of errors. Just as a side note, dont HIDE them
> > trough SEH(ugly aint it ?), but actualy handle the situation, one way or
> > another
> >
> > Reagrds, Dan
> >
> >
> >
> >
> > ----- Original Message -----
> > From: “James Dunning”
> > To: “File Systems Developers”
> > Sent: Friday, July 12, 2002 1:51 PM
> > Subject: [ntfsd] Re: Having problems getting CcMapData to work!..
> >
> >
> > > Thanks for the reply…
> > >
> > > I have just placed a try{} and except{} wrap around the call to
> > > CcMapData(…) and you were right, I am getting an exception! I have
> > managed
> > > to get the exception code and it returning the following status code,
> > > STATUS_IN_PAGE_ERROR 0xC0000006L
> > >
> > > which I think means that for some reason, the data is not placed into
> > memory
> > > due to an io error?
> > >
> > > Has anyone come across this problem before? and perhaps have an idea
how
> > to
> > > get a better understanding why this error is recurring and resolve
this
> > > situation?
> > >
> > > Regards
> > > James
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Dan Partelly [mailto:xxxxx@rdsor.ro]
> > > Sent: 11 July 2002 16:33
> > > To: File Systems Developers
> > > Subject: [ntfsd] Re: Having problems getting CcMapData to work!..
> > >
> > >
> > > As far as I know, this routine has nothing to do with fast IO.
> > >
> > > However , your debugger behaves strangley.
> > > Practice told me that many Cc functions can raise exceptions so Id
> sugest
> > to
> > > have a try{} except{}
> > > construct wrapping this call and see if you can catch an exception.
If
> > yes,
> > > the status code
> > > can be enlightning.
> > >
> > > Dan
> > >
> > > “James Dunning” wrote in
message
> > > news:xxxxx@ntfsd…
> > > >
> > > > But can CcMapData be called without the use of FastIo?
> > > >
> > > > The Wait parameter was actually already set to TRUE, but as i step
> over
> > > the
> > > > CcMapData(…) routine Softice seem to behave rather strangely and
> fails
> > > to
> > > > step to the next routine, it either exits from the softice debugger
> and
> > > goes
> > > > back to the main windows xp desktop, or to the original break point
> just
> > > > above the point where CcMapData(…) is actually called… either
> way,
> > > this
> > > > is preventing me from examining the buffer returned from CcMapData!
> > > >
> > > > I am wondering if i have missed something out while setting up the
> cache
> > > > (like not initializing fastio) or whether there is a problem
> currupting
> > > the
> > > > memory somewhere, which is causing this bizzare behavour.
> > > >
> > > > Any advice?
> > > >
> > > > Regards,
> > > > James
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Dan Partelly [mailto:xxxxx@rdsor.ro]
> > > > Sent: 11 July 2002 14:12
> > > > To: File Systems Developers
> > > > Subject: [ntfsd] Re: Having problems getting CcMapData to work!..
> > > >
> > > >
> > > > Valid means TRUE , no ? If caching for the stream has been
> intialized,
> > > then
> > > > this routine can be called. This routine will return FALSE if the
> > mapping
> > > > request cannot be performed imediately, and the Wait parameter is
set
> to
> > > > FALSE. Set Wait to true, and see if you get the expected result.
> > > >
> > > > Dan
> > > >
> > > > ----- Original Message -----
> > > > From: “James Dunning”
> > > > To: “File Systems Developers”
> > > > Sent: Thursday, July 11, 2002 3:43 PM
> > > > Subject: [ntfsd] Having problems getting CcMapData to work!..
> > > >
> > > >
> > > > > Hi,
> > > > >
> > > > > I am currently having problems getting CcMapData(…) to work and
> > return
> > > > any
> > > > > valid data. I have debugged the code and the
> > CcInitializeCacheMap(…)
> > > > > appears to have initialized the cache map successfully…
> > > > >
> > > > > Could anyone tell me if in order for the CcMapData(…) to work,
do
> i
> > > need
> > > > > to implement and initialise the FastIO entry points? or can i use
> > > > CcMapData
> > > > > without having fastio support?
> > > > >
> > > > > Regards,
> > > > > James…
> > > > >
> > > > >
> > > > > —
> > > > > You are currently subscribed to ntfsd as: xxxxx@rdsor.ro
> > > > > To unsubscribe send a blank email to %%email.unsub%%
> > > > >
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntfsd as:
> > > > xxxxx@generaldynamics.uk.com
> > > > To unsubscribe send a blank email to %%email.unsub%%
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntfsd as:
> > > xxxxx@generaldynamics.uk.com
> > > To unsubscribe send a blank email to %%email.unsub%%
> > >
> > >
> > > —
> > > You are currently subscribed to ntfsd as: xxxxx@rdsor.ro
> > > To unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as:
> > xxxxx@generaldynamics.uk.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@rdsor.ro
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntfsd as:
> xxxxx@generaldynamics.uk.com
> To unsubscribe send a blank email to %%email.unsub%%
>
>
>
—
You are currently subscribed to ntfsd as:
xxxxx@generaldynamics.uk.com
To unsubscribe send a blank email to %%email.unsub%%
—
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to %%email.unsub%%