Message 1 of 3
20 Mar 17 15:39
Join Date: 17 Feb 2012
Posts To This List: 644
Re: How to flush memory mapped files?
In addition to these comments, check out the FAT source code to see how=20
it attempts to maintain data sync for the various write pathways. It=20
performs, or attempts to perform a flush, for example in the non-cached=20
(non-paging) path prior to allowing the IO through if there is a backing=
section to the file.
Windows File System and Device Driver Consulting
------ Original Message ------
To: "Windows File Systems Devs Interest List"
Sent: 3/20/2017 1:08:55 PM
Subject: RE:[ntfsd] How to flush memory mapped files?
>If your driver maintains( i.e. initializes ) file objects then=20
>CcFlushCache is your friend as it calls MmFlushSection even for=20
>non-cached files ( i.e. mapped but not cached ), if the file is mapped=20
>and cached then the cache is supported by the same pages as the mapped=20
>virtual address range. Do not forget about proper synchronization=20
>before calling CcFlushCache.
>If your driver doesn't maintain file objects and uses file objects=20
>initialized by FSD(file system driver) it is attached to then there is=20
>no common way to do this. You can play with IRP_MJ_FLUSH_BUFFERS or you=
>can use CcFlushCache, in the latter with a risk of going into conflict=20
>with FSD and MM( Memory Manager ) as you will be unable to properly=20
>synchronize with FSD before calling CcFlushCache.
>NTFSD is sponsored by OSR
>MONTHLY seminars on crash dump analysis, WDF, Windows internals and=20
<...excess quoted lines suppressed...>