is storport io request related to pagefile

Is there a “correct” way to tell if a storport (or scsiport) io request is related to pagefile access?

Under Xen I have access to a type of storage that is faster than disk but (slightly) slower than memory and is considered volatile, and any given write may be denied if Xen currently has insufficient storage. As such it would be a good candidate for using as a cache for pagefile, but to make that work I would need to be able to reliably identify writes to and reads from the Windows pagefile, and also to know when the pagefile metadata changes (eg pagefile grows or shrinks etc). And to really do it properly I would also need to know when the page stored on the pagefile was invalidated, but simply maintaining a LRU write-back cache would probably be sufficient.

Or maybe a filesystem filter driver would be a better way to do this, taking care of such things before storport gets involved? Do paging requests go “via” the filesystem or does the filesystem only handle the metadata for pagefile and the virtual memory manager performs io direct to disk?

(maybe we need an additional mailing list like ntcrackpot for ideas that might turn out to be crazy?)

Thanks

James

>As such it would be a good candidate for using as a cache for pagefile,

It would be a good candidate for using as a cache for everything, not only pagefile.

Or maybe a filesystem filter driver would be a better way to do this

Maybe.

Do paging requests go “via” the filesystem

IIRC yes, and the file object is marked by some FO_xxx flag.


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

>

>As such it would be a good candidate for using as a cache for pagefile,

It would be a good candidate for using as a cache for everything, not only
pagefile.

Not really. Pagefile contents to not need to persist across reboots (as long as I handle the hiber and dump cases as exceptions to that) but otherwise it’s as dangerous as using a volatile write cache without the OS knowing that you are doing so. I guess you could use it as a write-through cache to avoid that, and only write-back in the case of pagefile… the xen provide cache isn’t infinite though so pagefile access is probably best.

Xen also provides another type of cache that you can write data to but have no guarantee it will still be there when you go to get it later… under Linux this can be used as a second level page cache (eg if your 2cached data got thrown out you just go read it from disk again and have lost nothing apart from a few extra microseconds of lookup). I’m not sure I have visibility under windows to when data gets evicted from the page cache though, or if the other required hooks exist.

>Or maybe a filesystem filter driver would be a better way to do this

Maybe.

I’m now thinking definitely… at storport level I think I’m too blind to the IO happening in the layers above.

>Do paging requests go “via” the filesystem

IIRC yes, and the file object is marked by some FO_xxx flag.

Thanks for that. I also found a FsRtlIsPagingFile too.

James

>but to make that work I would need to be able to reliably identify writes to and reads from the >Windows pagefile, and also to know when the pagefile metadata changes (eg pagefile grows or >shrinks etc).

Have you looked “IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES”(DeviceDsmAction_Notification)? If a driver registers this IOCTL Windows sends a range of LBA’s belonging to a page file. And Windows resend the IOCTL in case if the size of page file is changed(pagefile grows or shrinks).

Igor Sharovar

Weeeellll… I don’t know about once you’re into Storport, but if you have a PFILE_OBJECT you can call FsRtlIsPagingFile. This is pretty reliable, IIRC.

I’m not sure that helps you any, but…

Peter
OSR

What about older Windows versions?


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

wrote in message news:xxxxx@ntdev…
> >but to make that work I would need to be able to reliably identify writes to and reads from the >Windows pagefile, and also to know when the pagefile metadata changes (eg pagefile grows or >shrinks etc).
>
> Have you looked “IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES”(DeviceDsmAction_Notification)? If a driver registers this IOCTL Windows sends a range of LBA’s belonging to a page file. And Windows resend the IOCTL in case if the size of page file is changed(pagefile grows or shrinks).
>
> Igor Sharovar
>
>

>

Weeeellll… I don’t know about once you’re into Storport, but if you have a
PFILE_OBJECT you can call FsRtlIsPagingFile. This is pretty reliable, IIRC.

I’m not sure that helps you any, but…

I wrote my skeleton fs filter and FsRtlIsPagingFile returns true on reads and writes to the paging file. Nothing is straightforward though - no stream context allowed on paging file, and file context doesn’t exist for
James