delayed write possible?

Hello,
I am thinking to develop a minifilter driver in which, i will delay actual write to disk. I found that by specifying file as temporary its modified data will be held in cache until memory pressure comes. But, it will result in risk that by holding in cache the data may be lost. So, appropriate care should be taken about the delayed data in cache.

Can anyone tell me about the effectiveness of this implementation(or any other possible one). I am not sure about the performance. will this approach be useful…

First, if the file is cached the write will be delayed. If the user opens
the file non-cached delaying actions can cause serious problems since if
this is something like a database it will assume the data is on disk, and
delaying that can cause serious corruption.

So what are you really trying to achieve with this?


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntfsd…
> Hello,
> I am thinking to develop a minifilter driver in which, i
> will delay actual write to disk. I found that by specifying file as
> temporary its modified data will be held in cache until memory pressure
> comes. But, it will result in risk that by holding in cache the data may
> be lost. So, appropriate care should be taken about the delayed data in
> cache.
>
> Can anyone tell me about the effectiveness of this
> implementation(or any other possible one). I am not sure about the
> performance. will this approach be useful…
>
>
>

Hi Guru Prasad,

I am thinking to develop a minifilter driver in which, i will delay actual write to disk.

Hmm… First of all do you want to do it for file writes that pass through you? Or for the file(s) that your mini-filter is using for its own purpose?

If it is the first one, it should not be done.
If it is for the second purpose, i.e., your mini-filter uses it for its own purpose, the important thing to consider here is how critical is the data?
If it is really temporary, just make a temporary file by specifying the flag (FILE_DELETE_ON_CLOSE). I have actually never used this flag myself. And also let it open in a buffered manner, i.e., do not specify the FILE_NO_INTERMEDIATE_BUFFERING flag.

And if you want to be sure that whatever writes you issue are actually written to disk before a success status is returned, use the non-buffered option (FILE_NO_INTERMEDIATE_BUFFERING) while opening the file.

You can also consider the FILE_WRITE_THROUGH flag.

Regards,
Ayush Gupta

thank you both.
@Ayush
why are you saying that the first case should not be done?

Hi Guru Prasad,

why are you saying that the first case should not be done?

Because you cannot. You cannot pend a paging I/O request (that is when the data is actually written to the disk for a file opened in cached (buffered) mode). You can of course pend the Non-cached requests that are not paging. And of course the restriction of TopLevelIrp also apply.

Regards,
Ayush Gupta