Don
Tue Jul 22 14:43:24 CDT 2008
Of course most drivers do not use StartIo because of performance reasons,
and since the OP is talking storage most storage system fire multiple
requests if at all possible,
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website:
http://www.windrvr.com
Blog:
http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
"DeStefan" <DeStefan@discussions.microsoft.com> wrote in message
news:838790F8-FA91-463F-B43C-2483E749D72D@microsoft.com...
>> So, reading and writing happening in parallel will not have any impact
>> if i use sequential queue. The request which arrive first will be
>> processed and then the next one. Is it correct?
> This is not correct. Listen...
>
> Normal flow of irp's:
> IRP comes into your dispatchroutine.
> Here you make a decision: Will i treat the irp right now, or will i queue
> the irp?
> If you decide that you want to treat the irp right now, just do it. If it
> is
> a quick algorithm behind the treatment->No problem at all
> If you queue it, you will call IoStartPacket (sorry, i do not know the wdf
> pendant).
> This queues the irp or, if queue is empty already, will immediately call
> your StartIo function. As you can see, the Interface is not locked
> already,
> since you can still collect irp packets coming in.
> You should also know, that it does not matter if this is a read/write or
> ioctl call, the procedure is always the same, except the DispatchFunction
> is
> a different.
> As you see, there is no parellelness at all, but...
> but there is no rule that says, you must complete one irp before you treat
> the next irp, and this is the part that brings paralellness into the game.
> let's say you have queued two irps (1 read and 1 write).
> Your StartIo routine is being called. You dequeue the first irp (the
> read).
> Now you start a helper thread and pass the irp to this thread. At this
> moment the thread does the long term job. in the meanwhile you can
> continue
> to dispatch the next irp (the write). Simply call IoStartNextPacket()
> remember that the first one is still running on the other thread. You can
> procede in the same manner like the read before.
> Of course, you have to care about synchronisation topics. But as soon as
> the
> threads are finished, you can complete the IRP within the thread, but this
> does not bother your queue.
>
> Another information:
> I don't know if you are using overlapped mode. If not, i am using a good
> trick in my drivers:
> Just opening more than one instances to the interface (multiple file opens
> to the driver, each for another thread), then any operation
> (read/write/ioctl
> call) may concurrently exchange data with the driver without blocking
> (except
> if i block on a dispatch object like mutex or semaphore is explicitly
> demanded).
> Even if i am not using the multithread technique i mentioned before!!!!
> Therefore i never queue anything and always dispatch my irps right in the
> dispatchroutine (without startio)