Storage Filter Driver's IoCompletion Routines

A storage filter driver's IoCompletion routine is called when lower-level drivers (port, class, and additional filter drivers, if any) have called IoCompleteRequest. The IoCompletion routine of an storage filter driver (SFD) should return STATUS_MORE_PROCESSING_REQUIRED to prevent completion processing of a driver-allocated IRP, or to retain an original IRP if the SFD will reuse the IRP before completing it.

Like any other higher-level driver, the IoCompletion routine of an SFD is responsible for calling IoFreeIrp to release any IRP the driver's Dispatch routines created with IoAllocateIrp or IoBuildAsynchronousFsdRequest.

Depending on its device, an SFD might supply an IoCompletion routine for IRPs it sends to the next-lower driver from its Dispatch routines. In particular, a device that retrieves and processes data in a nonstandard format might require the SFD to have a TranslateDataIn routine called from its IoCompletion routine for transfer requests from such a device to system memory.

Note that such a TranslateDataIn routine would be called at IRQL == DISPATCH_LEVEL and in an arbitrary thread context. Therefore, the buffer into which the driver returns data either must be located in nonpaged pool or must be locked down and accessible using mapped, nonpaged system-space virtual addresses. For more information about safely accessing user-supplied buffers at raised IRQL, see Methods for Accessing Data Buffers.

In general, a storage filter driver should supply an IoCompletion routine with the same functionality as a class driver's IoCompletion routine for IRPs that the filter driver sets up with SRBs and CDBs. Consequently, a storage filter driver might have any or all of the ReleaseQueue, InterpretRequestSense, or RetryRequest routines that can be called from a storage class driver's IoCompletion routines.

For more information about InterpretRequestSense, RetryRequest, and ReleaseQueue routines, see Storage Class Drivers. For more information about general requirements for IoCompletion routines, see Using IoCompletion Routines.