Server Requests Flushing Cached Data

The server provides:

  • Open: An Open of a DataFile or DirectoryFile for which it is to flush cached data.

On completion, the object store MUST return:

  • Status: An NTSTATUS code that specifies the result.

The object store MUST flush all persistent attributes for Open.File to stable storage. In addition:

  • If Open.File.Volume.IsReadOnly is TRUE, the operation MUST be failed with STATUS_MEDIA_WRITE_PROTECTED.

  • The operation MUST be failed with the status code returned from the underlying physical storage. The operation flushes all eligible objects; however, only the first failure encountered is returned.

  • The operation ensures that the directory structure is persisted to stable storage.<61>

Pseudocode for the operation is as follows:

  • If Open.FileType is DirectoryFile:

    • CurrentDirectory = Open.DirectoryFile

      • Flush CurrentDirectory

    • While CurrentDirectory != CurrentDirectory.Volume.RootDirectory:

      • Set CurrentLink to the head of CurrentDirectory.LinkList, which is the only link because directories cannot have hard links.

      • CurrentDirectory = CurrentLink.ParentFile

        • Flush CurrentDirectory

    • EndWhile

  • EndIf

  • Flush all open objects on the volume.

  • If Open.File is equal to Open.File.Volume.RootDirectory:

    • For each OpenFile in Open.File.Volume.OpenFileList:

      • Flush OpenFile

    • EndFor

  • EndIf