CcDeferWrite function (ntifs.h)

The CcDeferWrite routine defers writing to a cached file. The post routine that is supplied, is called by the cache manager when it can accommodate the write operation.

Syntax

void CcDeferWrite(
  [in] PFILE_OBJECT            FileObject,
  [in] PCC_POST_DEFERRED_WRITE PostRoutine,
  [in] PVOID                   Context1,
  [in] PVOID                   Context2,
  [in] ULONG                   BytesToWrite,
  [in] BOOLEAN                 Retrying
);

Parameters

[in] FileObject

Pointer to a file object for the cached file to which the data is to be written.

[in] PostRoutine

Address of a routine for the cache manager to call to write to the cached file. Note that it is possible that this routine will be called immediately, even if CcCanIWrite has just returned FALSE .

The post routine is defined in ntifs.h as:

typedef
VOID (*PCC_POST_DEFERRED_WRITE) (
    _In_ PVOID Context1,
    _In_ PVOID Context2
    );

This function can be called with the TopLevelIrp field in the current IRP set to FSRTL_MOD_WRITE_TOP_LEVEL_IRP.

[in] Context1

First parameter for the post routine at PostRoutine.

[in] Context2

Second parameter for the post routine at PostRoutine.

[in] BytesToWrite

Number of bytes of data to be written.

[in] Retrying

Set to FALSE if the request is being posted for the first time, TRUE otherwise.

Return value

None

Remarks

A file system would normally call CcDeferWrite after receiving a return value of FALSE from CcCanIWrite.

To cache a file, use CcInitializeCacheMap.

The context parameters passed to PostRoutine are typically the I/O request and related context data.

Requirements

Requirement Value
Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe

See also

CcCanIWrite

CcInitializeCacheMap

CcSetDirtyPageThreshold