its win2k and above…
-Kiran
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Kiran Joshi
Sent: Tuesday, January 13, 2004 9:39 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] Why serialize the Read/Write Irps?
Hi,
if the driver is going to run only in 2k+ versions, kernel only handles can
be used to avoid the context problems. Then only in case of raised IRQLs you
will require to schedule the request to a separate thread.
thanks
-Kiran
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Tuesday, January 13, 2004 9:25 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] Why serialize the Read/Write Irps?
The disk driver can receive requests at a raised IRQL in the process context
that is not the same context that the request was sent down in. The cache
manager is also a case where the thread sending down the request is not the
process needed to do the file IO.
It is like this: file disk type drivers use a file to store the disk
sectors. The file must be opened to get a handle. The process that the
handle was opened in is the only process that can use the handle. If the
cache manager sends down a request to write some data to the disk, you will
probably not be in the context of the same process that you opened the file
in; unless you open and close the file each time 
The point here is that you need to make sure you are in a known process
context and at PASSIVE_LEVEL to access the file via the file handle. It is
easier to just put the request in a queue to a thread and let the thread
process the requests.
Jamey Kirby, Windows DDK MVP
StorageCraft Inc.
xxxxx@storagecraft.com
http://www.storagecraft.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Andrei Belogortseff
Sent: Monday, January 12, 2004 9:16 PM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] Why serialize the Read/Write Irps?
Process context for doing IO on the file is one of the two reasons for
using a thread.
Thank you, but I don’t understand. What can be wrong with the process
(thread?) context that can be fixed by queuing an Irp for processing by a
different thread? Could you please explain and/or give an example? Thanks a
lot!
Andrei.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Andrei
Belogortseff
Sent: Monday, January 12, 2004 5:46 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Why serialize the Read/Write Irps?
Hi all,
I’m studying the source code for the FileDisk driver (that lets one
mount a
file as a virtual disk) and see that when it gets IRP_MJ_READ or
IRP_MJ_WRITE, it adds them to the processing queue of the device thread,
and returns STATUS_PENDING. Then the device thread wakes up to process
and
complete the IRPs.
Is there a reason for queuing the IRPs rather than processing them right
away? Well, one reason I can see is that if we’ve received an Irp at an
elevated level, we would not want to process it at that level, and
queuing
the Irp lets us postpone the processing until the IRQL level is reduced.
Are there any other reasons for not processing the Irps right away?
If there are no other reasons, then I’m thinking about the following
algorithm (in pseudo code):
OnIrpReceived( Irp )
{
if ( there are other pending Irps in the device queue )
{
// add this Irp to the queue as well,
// to make sure the Irps are processed in the order they are
received
add the Irp to the queue for future processing;
return STATUS_PENDING;
}
else if ( IRQL level is higher than it is safe to process it
(PASSIVE_LEVEL?) )
{
add the Irp to the queue for future processing;
return STATUS_PENDING;
}
else
{
// at this point the IRQL level is low enough,
// and there are no other pending Irps in the queue
process the Irp right now;
complete the Irp;
}
}
Thank you in advance for any advice.
Andrei Belogortseff
WinAbility(r) Software Corp. [http://www.winability.com/]
“Useful Windows Utilities and Security Software”
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
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@calsoftinc.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@calsoftinc.com
To unsubscribe send a blank email to xxxxx@lists.osr.com