Linux sync_file_range 系统调用等同于 windows?

Equivalent of Linux sync_file_range system call on windows?

我需要 fsync 我附加到文件的字节范围而不强制刷新元数据(文件大小,...)。

正如您所说的 ring3 和 C++,答案如下:

您需要在映射文件后调用FlushViewOfFile。根据 MSDN:

The FlushViewOfFile function does not flush the file metadata, and it does not wait to return until the changes are flushed from the underlying hardware disk cache and physically written to disk.

来源:https://msdn.microsoft.com/en-us/library/windows/desktop/aa366563%28v=vs.85%29.aspx

写入数据和使用 FlushViewOfFile 的示例代码在这里:http://forums.codeguru.com/showthread.php?367742-FlushViewOfFile-does-not-Flush