Hi all,
I have two independent, through related, questions. Any help, suggestions,
or pointers would be most appreciated.
- When CcFlushCache() is called by the VMM or my FSD, multiple paged I/O
requests are passed to the page handler of my IRP_MJ_WRITE routine. My FSD
synchronously writes each request to disk. However, in some cases
CcFlushCache() performs two writes for every 64KB request.
For instance, the following output shows four writes from an Explorer file
copy from a different. Process 4 then performs a sync operation which calls
CcFlushCache(). CcFlushCache() triggers two paged writes for each offset
request. This trace is repeatable and I know for certain that the first
write (offset=0) makes it to disk.
[864,644] sfs_write(1694) ino=114, offset=0, size=65536, PageIo=0, SyncIo=1,
NonBufferedIo=0, WriteThrough=0
[864,644] sfs_write(1694) ino=114, offset=65536, size=65536, PageIo=0,
SyncIo=1, NonBufferedIo=0, WriteThrough=0
[864,644] sfs_write(1694) ino=114, offset=131072, size=65536, PageIo=0,
SyncIo=1, NonBufferedIo=0, WriteThrough=0
[864,644] sfs_write(1694) ino=114, offset=196608, size=21707, PageIo=0,
SyncIo=1, NonBufferedIo=0, WriteThrough=0
[4,1408] sfs_fsync(645) ino=114, difl=0x506e1, size=218315, vn=2,
cr=1076002386,669875000, line=1744
[4,1408] sfs_pagecache(1602) flush 114, difl=0x506e1, l=750
CcFlushCache() called here…
[4,1408] sfs_write(1694) ino=114, offset=0, size=65536, PageIo=1, SyncIo=1,
NonBufferedIo=1, WriteThrough=0
[4,1408] sfs_write(1694) ino=114, offset=65536, size=65536, PageIo=1,
SyncIo=1, NonBufferedIo=1, WriteThrough=0
[4,1408] sfs_write(1694) ino=114, offset=131072, size=65536, PageIo=1,
SyncIo=1, NonBufferedIo=1, WriteThrough=0
[4,1408] sfs_write(1694) ino=114, offset=196608, size=24576, PageIo=1,
SyncIo=1, NonBufferedIo=1, WriteThrough=0
[4,1408] sfs_write(1694) ino=114, offset=0, size=65536, PageIo=1, SyncIo=1,
NonBufferedIo=1, WriteThrough=0
[4,1408] sfs_write(1694) ino=114, offset=65536, size=65536, PageIo=1,
SyncIo=1, NonBufferedIo=1, WriteThrough=0
[4,1408] sfs_write(1694) ino=114, offset=131072, size=65536, PageIo=1,
SyncIo=1, NonBufferedIo=1, WriteThrough=0
[4,1408] sfs_write(1694) ino=114, offset=196608, size=24576, PageIo=1,
SyncIo=1, NonBufferedIo=1, WriteThrough=0
CcFlushCache() ends here
[4,1408] sfs_pagecache(1615) e=0
However, this behavior does not occur when using “copy” from a command
prompt or from a homegrown application that performs simple WriteFile()'s.
As far as I can tell, all FileObject, Irp, and create flags are the same.
Any ideas what could be causing the double write from CcFlushCache()? Any
ideas where else to look? Is is possible to tell within IRP_MJ_WRITE
routines where pages are dirty?
- Is there any way to tune the page write size of the VMM? Currently, my
IRP_MJ_WRITE routine only receives 64KB or smaller requests during paged
I/O. The FSD is very good at sequentially allocating disk blocks, so
increasing request sizes would reduce the number of disk I/O’s.
Thanks in advance. Best regards,
Steve Soltis