From: uba on
Thank you for the replies.

I had changed the design to create a default parallel queue and then
forward the read requests to read queue and write requests to write
queue. But still i do not get the second request if I do not submit
the first request down the stack.

Here is the code snippet.


WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig,
WdfIoQueueDispatchParallel);

ioQueueConfig.EvtIoRead = FilterEvtIoRead;
ioQueueConfig.EvtIoWrite = FilterEvtIoWrite;
ioQueueConfig.EvtIoDeviceControl = FilterEvtIoDeviceControl;
ioQueueConfig.EvtIoInternalDeviceControl =
FilterEvtIoInternalDeviceControl;

status = WdfIoQueueCreate(device,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
&defaultqueue
);
if (!NT_SUCCESS(status)) {
KdPrint( ("WdfIoQueueCreate failed 0x%x\n", status));
return status;
}

WDF_IO_QUEUE_CONFIG_INIT(&ioQueueConfig,
WdfIoQueueDispatchManual);

status = WdfIoQueueCreate (device,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
&filterExt->ReadQueue
);

if (!NT_SUCCESS(status)) {
KdPrint((" WdfIoQueueCreate for Read failed %!STATUS!\n",
status));
return status;
}

WDF_IO_QUEUE_CONFIG_INIT(&ioQueueConfig,
WdfIoQueueDispatchManual);

status = WdfIoQueueCreate (device,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
&filterExt->WriteQueue
);

if (!NT_SUCCESS(status)) {
KdPrint((" WdfIoQueueCreate for Write failed %!STATUS!\n",
status));
return status;
}
From: uba on
In my dispatch routine i get the request. The request is then fowarded
to either read queue or write queue. I signal the read or write thread
which retrieves the request from the queue.

I do not want to submit the request down the stack right now but want
to wait for next request to arrive and merge them to a new request. I
would then send the new request down the stack. Upon completion of
this new request I want to complete the original two requests. Is this
a possible scenario?

Thanks nd Regards,
kid
From: Don Burn on
Yes it is possible. You do not need threads for this.

1. Create the read queue
2. Create a manual queue for holding reads to merge
3. Create a manual queue for holding original requests to complete
4. On the EvtIoRead of the read queue, if the queue for merges was
empty store the new request into that queue, ELSE
5. On an EvtIoRead of the read queue, check the queue for merges and
if it has a request
a. Do the merge into a new request
b. Using the context of that request to record data on the
two requests you merged
c. Store the two request in the queue to hold requests for
completion
d. Forward the new request to the I/O target
6. On completion of the new request from 5d use the context to find
the original requests and complete them


--
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply



..




"uba" <kid07.uba(a)gmail.com> wrote in message
news:0d611cc9-b395-410b-9039-1d39c8099407(a)x1g2000prb.googlegroups.com...
> In my dispatch routine i get the request. The request is then fowarded
> to either read queue or write queue. I signal the read or write thread
> which retrieves the request from the queue.
>
> I do not want to submit the request down the stack right now but want
> to wait for next request to arrive and merge them to a new request. I
> would then send the new request down the stack. Upon completion of
> this new request I want to complete the original two requests. Is this
> a possible scenario?
>
> Thanks nd Regards,
> kid
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4831 (20100203) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4831 (20100203) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




From: uba on
> Yes it is possible.   You do not need threads for this.
>
>       1.  Create the read queue
>       2.  Create a manual queue for holding reads to merge
>       3.  Create a manual queue for holding original requests to complete
>       4.  On the EvtIoRead of the read queue, if the queue for merges was
> empty store the new request into that queue, ELSE
>       5.  On an EvtIoRead of the read queue, check the queue for merges and
> if it has a request
>                  a.  Do the merge into a new request
>                  b.  Using the context of that request to record data on the
> two requests you merged
>                  c.  Store the two request in the queue to hold requests for
> completion
>                  d.  Forward the new request to the I/O target
>       6.  On completion of the new request from 5d use the context to find
> the original requests and complete them
>

Thank you for the reply. So, I need 3 queues here. Here is my
understanding.

1 Default queue to get read/write requests. (Parallel Queue)
2 Queue to hold original read/write request (Manual Queue)
3 Queue to hold merged read/write requests (Manual Queue)

As I get the first request i forwarded to queue 2. I do not get the
second request i.e EvtIoRead in never called for second time as the
first request is not processed. Do i need to mark the first request
pending so that the second request arrive?

Do you think i missed anything here?

Thanks nd Regards
kid
From: Don Burn on
Obviously you need a mechanism for what to do if the first request comes and
no second request. You do not need to mark the requests pending, the
framework takes care of the details. The first queue should be serial,
otherwise you will not know the ordering of the requests. Note: this is
not a problem since once the request is in another queue the default queue
is free to send the next request.

Obviously there are variants and other approaches, but as an approach this
should work.


--
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply




"uba" <kid07.uba(a)gmail.com> wrote in message
news:b35fc4b9-f947-4480-b50c-892585b582c9(a)z10g2000prh.googlegroups.com...
> Yes it is possible. You do not need threads for this.
>
> 1. Create the read queue
> 2. Create a manual queue for holding reads to merge
> 3. Create a manual queue for holding original requests to complete
> 4. On the EvtIoRead of the read queue, if the queue for merges was
> empty store the new request into that queue, ELSE
> 5. On an EvtIoRead of the read queue, check the queue for merges and
> if it has a request
> a. Do the merge into a new request
> b. Using the context of that request to record data on the
> two requests you merged
> c. Store the two request in the queue to hold requests for
> completion
> d. Forward the new request to the I/O target
> 6. On completion of the new request from 5d use the context to find
> the original requests and complete them
>

Thank you for the reply. So, I need 3 queues here. Here is my
understanding.

1 Default queue to get read/write requests. (Parallel Queue)
2 Queue to hold original read/write request (Manual Queue)
3 Queue to hold merged read/write requests (Manual Queue)

As I get the first request i forwarded to queue 2. I do not get the
second request i.e EvtIoRead in never called for second time as the
first request is not processed. Do i need to mark the first request
pending so that the second request arrive?

Do you think i missed anything here?

Thanks nd Regards
kid

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4831 (20100203) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





__________ Information from ESET NOD32 Antivirus, version of virus signature database 4831 (20100203) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com