when a data is cached from minifilter view.

Hi all,
I got 2 questions:

  1. If I complete a cached pre wite operation with success status, did I prevent the cache manager from caching file content or not?
  2. what happens if I do not allocate the write buffer and do not swap it like how swap buffer sample does, but change only some bytes in the write buffer in pre write for cached IO?
    does the new data get cached?

In short, the answer to both are yes. For 1., you would also want to set
the IoStatus.Information to the length of the requested write to
indicate how many bytes were ‘successfully’ written.

Pete


Kernel Drivers
Windows File System and Device Driver Consulting
www.KernelDrivers.com
866.263.9295

------ Original Message ------
From: xxxxx@yahoo.com
To: “Windows File Systems Devs Interest List”
Sent: 5/23/2017 7:05:34 AM
Subject: [ntfsd] when a data is cached from minifilter view.

>Hi all,
>I got 2 questions:
>
>1. If I complete a cached pre wite operation with success status, did I
>prevent the cache manager from caching file content or not?
>2. what happens if I do not allocate the write buffer and do not swap
>it like how swap buffer sample does, but change only some bytes in the
>write buffer in pre write for cached IO?
>does the new data get cached?
>
>—
>NTFSD is sponsored by OSR
>
>
>MONTHLY seminars on crash dump analysis, WDF, Windows internals and
>software drivers!
>Details at http:
>
>To unsubscribe, visit the List Server section of OSR Online at
>http:</http:></http:>

You will prevent only modifying cached content and file data on the storage. If the data has been put in the cache by the read-ahead or clustering functionality it will stay in the cache as unmodified file data. That means that your method will fail depending on many conditions like total memory size, cache utilization, CPU utilization. I believe you know that creating and mapping a section will also subvert this method.

The modified data will be written in the cache and a file. Depending on file system I/O buffering method a user application might observe its buffer as modified.

Thanks for the replies :slight_smile:

>>You will prevent only modifying cached content and file data on the storage. If

>the data has been put in the cache by the read-ahead or clustering functionality
>it will stay in the cache as unmodified file data. That means that your method
>will fail depending on many conditions like total memory size, cache
>utilization, CPU utilization. I believe you know that creating and mapping a
>section will also subvert this method.

well I did not mean it will prevent the whole file from being cached. I just meant that certain write buffer in the IRP which I completed. Thanks for the detailed answer anyways. Details always help me learn more.

>you would also want to set=20
the IoStatus.Information to the length of the requested write to=20
indicate how many bytes were ‘successfully’ written.

This helped as well. Thanks again