CcMdlWriteComplete function

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

Syntax

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

Parameters

FileObject

File object pointer that was passed to CcPrepareMdlWrite.

FileOffset

Value of FileOffset that was passed to CcPrepareMdlWrite.

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

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

See Also

CcMdlWriteAbort

CcPrepareMdlWrite