CcMdlWriteComplete function (ntifs.h)

The CcMdlWriteComplete routine frees the memory descriptor lists (MDL) created by CcPrepareMdlWrite for a cached file.

Syntax

void CcMdlWriteComplete(
  [in] PFILE_OBJECT   FileObject,
  [in] PLARGE_INTEGER FileOffset,
  [in] PMDL           MdlChain
);

Parameters

[in] FileObject

File object pointer that was passed to CcPrepareMdlWrite.

[in] FileOffset

Value of FileOffset that was passed to CcPrepareMdlWrite.

[in] MdlChain

Address of the MDL chain returned by CcPrepareMdlWrite.

Return value

None

Remarks

File systems call CcMdlWriteComplete to free the memory descriptor lists (MDL) created by CcPrepareMdlWrite for a cached file and to mark the specified byte range for write. All physical pages that were locked down are unlocked. Any pages that were mapped are unmapped.

If the FO_WRITE_THROUGH flag is set on the file object pointed to by the FileObject parameter, the file data is immediately flushed to disk. This flush operation re-enters the file system and can cause CcMdlWriteComplete to raise an exception if the flush operation fails. In this case, the MDL has not been freed and the caller may re-try the operation.

After CcMdlWriteComplete is called successfully for an IRP_MN_COMPLETE operation, the caller must set the IRP's MdlAddress field to NULL.

Before using CcMdlWriteComplete, file system developers are strongly encouraged to study the way this routine is used in the FASTFAT sample.

Each call to CcPrepareMdlWrite must be followed by a call to CcMdlWriteComplete or CcMdlWriteAbort.

Requirements

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

See also

CcMdlWriteAbort

CcPrepareMdlWrite