How to retrieve STOR_REQUEST_INFO in Lower Disk Class driver

How to get STOR_REQUEST_INFO structure in Lower Disk Class Filter driver ?

In miniport driver we can retrieve it using StorPortGetRequestInfo API which has this structure as an output parameter but I want to access this structure in Lower Filter driver to Disk Class or in Upper Filter driver to SCSI adapter. We wont be able to use this StorPortGetRequestInfo API in filter driver, right ?? I have checked SRB members and IRP flags it doesnt have these details. Can someone help me in this ?

Thanks in advance,
Davis

I don’t think STOR_REQUEST_INFO is even exists on this level, before the IRP came to StorPort.

Only IRP+MDL+SRB do exist above StorPort, not some “request info”.

Look at Disk.sys source in samples. Any STOR_REQUEST_INFO there?


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

wrote in message news:xxxxx@ntdev…
> How to get STOR_REQUEST_INFO structure in Lower Disk Class Filter driver ?
>
> In miniport driver we can retrieve it using StorPortGetRequestInfo API which has this structure as an output parameter but I want to access this structure in Lower Filter driver to Disk Class or in Upper Filter driver to SCSI adapter. We wont be able to use this StorPortGetRequestInfo API in filter driver, right ?? I have checked SRB members and IRP flags it doesnt have these details. Can someone help me in this ?
>
> Thanks in advance,
> Davis
>

Thank you…Yes I do understand STOR_REQUEST_INFO doesn’t exist in Filter level. But my objective is to retrieve following flags contained in this structure in the filter driver, to perform some operations on the drive based on the flags which are set.

StorPortGetRequestInfo API is used to get these flags in miniport, from where does the storport get this information. I dont get to find these flags in IRP’s or SRB’s. Is there any way we can get the corresponding data from IRP or SRB.

REQUEST_INFO_NO_CACHE_FLAG - Non-cached writes are specified for this request.
REQUEST_INFO_PAGING_IO_FLAG - Paging IO is specified for this request.
REQUEST_INFO_SEQUENTIAL_IO_FLAG - Reads or writes are sequential.
REQUEST_INFO_TEMPORARY_FLAG - The file for this request is temporary.
REQUEST_INFO_WRITE_THROUGH_FLAG - No system buffering for the request.

> REQUEST_INFO_NO_CACHE_FLAG - Non-cached writes are specified for this request.

REQUEST_INFO_PAGING_IO_FLAG - Paging IO is specified for this request.
REQUEST_INFO_SEQUENTIAL_IO_FLAG - Reads or writes are sequential.
REQUEST_INFO_TEMPORARY_FLAG - The file for this request is temporary.
REQUEST_INFO_WRITE_THROUGH_FLAG - No system buffering for the request.

Aren’t they in the IRP stack location?


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

Yes I found it !! :slight_smile: I had used IRP stack location to retrieve SRB using (irpStackLoc->Parameters.Scsi.Srb) but mybad, somehow missed FileObject member in the stack location earlier, these flags are contained in there.

Thank you !!
Davis

irpSp itself also has ->Flags


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

wrote in message news:xxxxx@ntdev…
> Yes I found it !! :slight_smile: I had used IRP stack location to retrieve SRB using (irpStackLoc->Parameters.Scsi.Srb) but mybad, somehow missed FileObject member in the stack location earlier, these flags are contained in there.
>
> Thank you !!
> Davis
>

Yes it has flag field but irpSp->Flag doesn’t correspond to the flags which are actually required. I mean there is no mapping between them.

FileObject member is always NULL even though I am performing write on the file. Cant we access file object present in current IOStack location in Filter driver, if not where can we get these flags ??

I still do not know from where the StorPort gets these details.

Thank you !!
Davis

> Yes it has flag field but irpSp->Flag doesn’t correspond to the flags which are actually required. I

mean there is no mapping between them.

SL_WRITE_THROUGH -> REQUEST_INFO_WRITE_THROUGH_FLAG
SL_FT_SEQUENTIAL_WRITE -> REQUEST_INFO_SEQUENTIAL_IO_FLAG

Not sure about SL_FORCE_DIRECT_WRITE, can be REQUEST_INFO_NO_CACHE_FLAG

Also look at IoGetIoPriorityHint

FileObject member is always NULL even though I am performing write on the file.

Correct. For disk block IO it is not used.

Cant we access file object present in current IOStack location in Filter driver

In disk filter? no, not at all.

I still do not know from where the StorPort gets these details.

Walk the function in the debugger step by step, analyzing the allocation tags of the structures involved to find an IRP among them, and look at how the function analyzes the IRP.

Also, Disk.sys source used to be provided with the WDK, so, you can also look there too (how Disk.sys fills the SCSI IRP).


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

Thank you !!

Verified the following mappings
SL_WRITE_THROUGH -> REQUEST_INFO_WRITE_THROUGH_FLAG
SL_FORCE_DIRECT_WRITE -> REQUEST_INFO_NO_CACHE_FLAG

but the following one is not true
SL_FT_SEQUENTIAL_WRITE -> REQUEST_INFO_SEQUENTIAL_IO_FLAG