Cancel_Routine

Hi,

Is it necessary to have a IoSetCancel() Routine when we are in storage stack and doing the io processing.as a filter driver to volume is it good to have a cancle routine for irp’s which are may terminated bu io manager!

Thanks.

A driver can only set a cancel routine to the IRPs it holds in its own queue. If the driver passes the IRPs further, the cancel routine must be NULL.

Of those IRPs you hold, you only need a cancel routine if you possibly can hold them for indefinite time. If you can guarantee they are completed in less than a few seconds, you don’t need a cancel routine.

Thanks a lot Alex!

I did capture all the IRP_MJ_WRITE,once i needed dequeue them and complete the irp in a seprate Thread. now i ran Defragger on a particular volume capturing the write(or heavy io) in the same manner Now if the volume itself is fragmeted upto 10% then Defragger will take more time, that time whether i Need to keep a cancel routine in driver?

I don’t think storage stack ever uses cancellation.

Cancellation is used for things like COM port read, TCP socket read, USB bulk read, which depend on data arrival from the other side, and such arrival can NEVER occur in some cases.

Cancellation is exactly to handle such cases.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi,
>
> Is it necessary to have a IoSetCancel() Routine when we are in storage stack and doing the io processing.as a filter driver to volume is it good to have a cancle routine for irp’s which are may terminated bu io manager!
>
> Thanks.
>

My characterization is that cancellation is important when your device has
a potentially unbounded response time. In such cases, it may be necessary
to abort the currently active IRP, which may already have programmed the
DMA (that is never going to happen because the device is wedged), and
consequently cancellation of an active transfer may depend upon the nature
of the hardware, e.g., can it abort a DMA request cleanly.

Storage devices rely on the myth that storage systems will complete within
a known, bounded time, and this works fine until you virtualize the file
system to a remote device that may have unbounded response time.
joe

I don’t think storage stack ever uses cancellation.

Cancellation is used for things like COM port read, TCP socket read,
USB bulk read, which depend on data arrival from the other side, and
such arrival can NEVER occur in some cases.

Cancellation is exactly to handle such cases.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
>> Hi,
>>
>> Is it necessary to have a IoSetCancel() Routine when we are in storage
>> stack and doing the io processing.as a filter driver to volume is it
>> good to have a cancle routine for irp’s which are may terminated bu io
>> manager!
>>
>> Thanks.
>>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>