From: 小太 <nospam@kota.moe> This allows various disk benchmarking software like CrystalDiskMark and ATTO disk benchmark to actually benchmark the disk rather than the file cache Implementation based on public Microsoft NtCreateFile() documentation: https://learn.microsoft.com/en-us/windows/win32/api/winternl/nf-winternl-ntc... --- server/fd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/fd.c b/server/fd.c index f70bec354a3..eb84015ae88 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1974,6 +1974,17 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam } else rw_mode = O_RDONLY; + if (options & FILE_NO_INTERMEDIATE_BUFFERING) + { +#if defined(O_DIRECT) /* O_DIRECT is not available on OSX */ + flags |= O_DIRECT; +#endif + /* FILE_NO_INTERMEDIATE_BUFFERING implies FILE_WRITE_THROUGH according + to NtCreateFile() documentation */ + options |= FILE_WRITE_THROUGH; + } + if (options & FILE_WRITE_THROUGH) flags |= O_SYNC; + if ((fd->unix_fd = open( name, rw_mode | (flags & ~O_TRUNC), *mode )) == -1) { /* if we tried to open a directory for write access, retry read-only */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9809