CcFlushCache does not synchronize vs. others flushers who have picked up ranges of the file to flush, to guarantee that all the ranges have been flushed by the time this call returns. That is left to the filesystem.
This is FAT dealing with that, making sure there is no instance of the lazy writer currently active on that file by the time it calls purge. Look at the resources it acquires in the AcquireForLazyWrite callback.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Petr Borsodi
Sent: Wednesday, November 07, 2007 11:50 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] CcFlushCache question
Hi all,
Can anybody explain me exactly, why fastfat use acquring and releasing of
PagingIoResource after CcFlushCache (see comment) ?
It seems strange - CcFlushCache call is synchronous operation and all data
should be written on return. I made some tests and it looks really
important -
without acquiring PagingIoResource rarely data is not completelly written.
Thanks
Petr
CcFlushCache( &Fcb->NonPaged->SectionObjectPointers, NULL,
0, NULL );
//
// Grab and release PagingIo to serialize ourselves with
the lazy writer.
// This will work to ensure that all IO has completed on
the cached
// data and we will succesfully tear away the cache
section.
//
ExAcquireResourceExclusiveLite(
Fcb->Header.PagingIoResource, TRUE);
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
CcPurgeCacheSection( &Fcb->NonPaged->SectionObjectPointers,
NULL,
0,
FALSE );
NTFSD is sponsored by OSR
For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars
You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com