Read IRP Handler Impl. Help Wanted

Hello all.

We are developing a FSD. We have been following Rajeev Nagar’s book so
far and all went well until we have stumbled upon the Read IRP. Then we
went puzzled.

The question is: How do we feed the Cache Manager with the data for an
opened file?

As OSR IFS FAQ states, “If the virtual cache buffer contents are not all
resident in memory, then the copy process will trigger a page fault,
which generates a second re-entrant I/O operation via the paging mechanism.”

Then, the question is, how we implement the handler for the second
re-entrant operation? Is that the same Read IRP handler that’ll be
triggered in such case or it’s some another handler that needs to be
implemented? If it’s the same Read IRP handler, then how we distinguish
this “second re-entrant call” from the first one and actually deliver
the data contained in a file to the cache manager?

I hope, I didn’t mess the description.

Any clues will be highly appreciated.

Andrey.

The first read is a user read. The second is a paging I/O
(IRP_PAGING_IO in the Irp->Flags field.) The second may be against the
same or a different file object, but it will be for the same file.

If you want to put your data in the cache, you want to respond to the
IRP_PAGING_IO.

If the file is memory mapped (e.g., notepad) then you’ll only see the
paging I/O operation.

Regards,

Tony

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

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Andrey Subbotin
Sent: Monday, July 17, 2006 10:30 AM
To: ntfsd redirect
Subject: [ntfsd] Read IRP Handler Impl. Help Wanted

Hello all.

We are developing a FSD. We have been following Rajeev Nagar’s book so
far and all went well until we have stumbled upon the Read IRP. Then we
went puzzled.

The question is: How do we feed the Cache Manager with the data for an
opened file?

As OSR IFS FAQ states, "If the virtual cache buffer contents are not all

resident in memory, then the copy process will trigger a page fault,
which generates a second re-entrant I/O operation via the paging
mechanism."

Then, the question is, how we implement the handler for the second
re-entrant operation? Is that the same Read IRP handler that’ll be
triggered in such case or it’s some another handler that needs to be
implemented? If it’s the same Read IRP handler, then how we distinguish
this “second re-entrant call” from the first one and actually deliver
the data contained in a file to the cache manager?

I hope, I didn’t mess the description.

Any clues will be highly appreciated.

Andrey.


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

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

Your driver will receive another IRP( with the IRP_PAGING_IO flag ) in the
same thread context. This IRP will be sent by the page fault handler. That
is, in the call stack you will see the first call for non paging read, and
then the call to the page fault handler from CcCopyRead( if you call it from
your FSD ).

“Andrey Subbotin” wrote in message news:xxxxx@ntfsd…
> Hello all.
>
> We are developing a FSD. We have been following Rajeev Nagar’s book so far
> and all went well until we have stumbled upon the Read IRP. Then we went
> puzzled.
>
> The question is: How do we feed the Cache Manager with the data for an
> opened file?
>
> As OSR IFS FAQ states, “If the virtual cache buffer contents are not all
> resident in memory, then the copy process will trigger a page fault, which
> generates a second re-entrant I/O operation via the paging mechanism.”
>
> Then, the question is, how we implement the handler for the second
> re-entrant operation? Is that the same Read IRP handler that’ll be
> triggered in such case or it’s some another handler that needs to be
> implemented? If it’s the same Read IRP handler, then how we distinguish
> this “second re-entrant call” from the first one and actually deliver the
> data contained in a file to the cache manager?
>
> I hope, I didn’t mess the description.
>
> Any clues will be highly appreciated.
>
> Andrey.
>

> Then, the question is, how we implement the handler for the second

re-entrant operation? Is that the same Read IRP handler that’ll be
triggered in such case or it’s some another handler that needs to be
implemented? If it’s the same Read IRP handler, then how we distinguish

Same read IRP handler, but the IRP is markes as noncached and paging IO.

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