CcCoherencyFlushAndPurgeCache routine

The CcCoherencyFlushAndPurgeCache routine flushes and/or purges the cache to ensure cache coherency. Use CcCoherencyFlushAndPurgeCache when possible instead of an explicit flush and purge call sequence as it will invalidate user mapped views to prevent data corruption.

Syntax


VOID CcCoherencyFlushAndPurgeCache(
  _In_      PSECTION_OBJECT_POINTERS SectionObjectPointer,
  _In_opt_  PLARGE_INTEGER FileOffset,
  _In_      ULONG Length,
  _Out_     PIO_STATUS_BLOCK IoStatus,
  _In_opt_  ULONG Flags
);

Parameters

SectionObjectPointer [in]

A pointer to a structure that contains the section object pointers of the file object.

FileOffset [in, optional]

A pointer to a variable that specifies the starting byte offset to flush, purge, or both.

Length [in]

The length, in bytes of the data to flush and/or purge starting at FileOffset. This parameter is ignored if a NULL pointer is passed to FileOffset.

IoStatus [out]

A pointer to a caller-allocated structure that receives the final completion status and information about the operation.

Flags [in, optional]

A bitmask of flags that specify how the operation is to be performed. The one flag is defined in the following table.

ValueMeaning

CC_FLUSH_AND_PURGE_NO_PURGE

Flush, but do not purge the cache. This is useful for read coherency flushes.

 

Return value

None

Remarks

The file must be acquired exclusively before you call CcCoherencyFlushAndPurgeCache.

You can flush and/or purge any byte range within a file by using the FileOffset and Length parameters. Or you can flush, purge, or both an entire file if you pass a NULL pointer to the FileOffset parameter.

A call to CcCoherencyFlushAndPurgeCache is a synchronous (blocking) operation, not an asynchronous (non-blocking) operation.

An IoStatus->Status value of STATUS_CACHE_PAGE_LOCKED indicates that page invalidation failed. Be aware that page invalidation can fail even if you pass CC_FLUSH_AND_PURGE_NO_PURGE in the Flags parameter.

Requirements

Version

Available in Windows 7 and later

Header

Ntifs.h (include Ntifs.h or FltKernel.h)

Library

Ntoskrnl.lib

IRQL

PASSIVE_LEVEL

See also

CcFlushCache
CcPurgeCacheSection

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.