NTFS zero-fill not seen as paging IOs

Hi,
I have a question about how NTFS will 0-fill a file if you SetEndOfFile further down and then write at that new EOF.

  1. Create a new file on an NTFS volume without specifying no buffering, so will use buffered IO.
  2. SetFilePointer to 0x1000403.
  3. SetEndOfFile at that offset.
  4. WriteFile 4 0’s at that end offset. So size would now be 0x1000407

The 0-fill from start of file up to 0x1000403 occurs as expected during the WriteFile call. But our driver is not seeing ANY such paging IOs. Does NTFS perform the 0-fill without using paging IOs?

BTW I know all about SetFileValidData to get past the 0-fill but not interested in that for this purpose.

> Does NTFS perform the 0-fill without using paging IOs?

No, I have certainly seen these. Indeed in certain circumstances you need
to work to stop NTFS doing that itself because the paging IOs do start at
the top of the stack.

Rod

On 01/14/2015 01:23 PM, xxxxx@swbell.net wrote:

  1. WriteFile 4 0’s at that end offset. So size would now be 0x1000407

NTFS has an optimization where if you a small number of zeroes to the
end of a file that would otherwise contain zeroes, it will ignore you
and write nothing at all. In this case the file size is 0x1000407 but
valid data has never been advanced. Try writing 0x01 instead.