I wrote my minifilter driver to test file write irp. In pre-write I called dbgprint to print flags, but found the output information is not consistent with my expectations.
My expectation is that the first time is cache write and the second time is noncache and paging io write.
But the logs shows that cache io direct write the data to the disk.(in 2)
i use filetest.exe created a file named "a.txt",and then wrote 0x1(1) bytes data, it will show me 2 lines logs, i know that one is cache io(write to the cache), and the other is lazy writer non cache and paging io(real write to the disk):
IsFastIo=0, NonCachedIo=0, PagingIo=0, SyncPagingIo=0, FileSize=0, AllocationSize=0, ValidDataLength=0, StartingVbo=0, ByteCount=1, FileFlags=0x40042, IrpFlags=0x60A00
IsFastIo=0, NonCachedIo=1, PagingIo=1, SyncPagingIo=1, FileSize=1, AllocationSize=8, ValidDataLength=1, StartingVbo=0, ByteCount=4096, FileFlags=0x44042, IrpFlags=0x20043
Then i use filetest.exe created a file named "b.txt",and then wrote 0x1001(!!!!important diffrence 4097) bytes data,but only one cached log show me. it is NOT noncache, and NOT paging io, and after wating for a while, still NO the lazy writer's write log.
IsFastIo=0, NonCachedIo=0, PagingIo=0, SyncPagingIo=0, FileSize=0, AllocationSize=0, ValidDataLength=0, StartingVbo=0, ByteCount=4097, FileFlags=0x40042, IrpFlags=0x60A00
I have done this experiment many times,only the diffrence is the size to write(1 byte and 4097 bytes) ,and I can reproduce the above situation every time.
I want to ask:
1.In 2 ,why only cache write log, no disk write log?
2.When was the data written to disk?