Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Cancel_Routine

NtDev_GeekNtDev_Geek Member - All Emails Posts: 98
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.

Comments

  • Alex_GrigAlex_Grig Member Posts: 3,238
    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.
  • NtDev_GeekNtDev_Geek Member - All Emails Posts: 98
    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?
  • Maxim_S._ShatskihMaxim_S._Shatskih Member Posts: 10,396
    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

    <xxxxx@gmail.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.
    >
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    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
    >
    > <xxxxx@gmail.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
    >
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
Writing WDF Drivers 25 Feb 2019 OSR Seminar Space
Developing Minifilters 8 April 2019 OSR Seminar Space