NTFileSystemAdapter: Use read-ahead mechanism unless FILE_NO_INTERMEDIATE_BUFFERING is set or FILE_RANDOM_ACCESS flag is set

This commit is contained in:
Tal Aloni 2017-05-18 22:52:13 +03:00
parent 8c0ff8fdad
commit dae8a6b19e

View file

@ -256,7 +256,7 @@ namespace SMBLibrary
// of a file copy operation (where the caller will attempt to simply copy the reparse point). // of a file copy operation (where the caller will attempt to simply copy the reparse point).
bool openReparsePoint = (openOptions & CreateOptions.FILE_OPEN_REPARSE_POINT) > 0; bool openReparsePoint = (openOptions & CreateOptions.FILE_OPEN_REPARSE_POINT) > 0;
bool disableBuffering = (openOptions & CreateOptions.FILE_NO_INTERMEDIATE_BUFFERING) > 0; bool disableBuffering = (openOptions & CreateOptions.FILE_NO_INTERMEDIATE_BUFFERING) > 0;
bool buffered = (openOptions & CreateOptions.FILE_SEQUENTIAL_ONLY) > 0 && !disableBuffering && !openReparsePoint; bool buffered = (openOptions & CreateOptions.FILE_RANDOM_ACCESS) == 0 && !disableBuffering && !openReparsePoint;
FileShare fileShare = NTFileStoreHelper.ToFileShare(shareAccess); FileShare fileShare = NTFileStoreHelper.ToFileShare(shareAccess);
string fileShareString = fileShare.ToString().Replace(", ", "|"); string fileShareString = fileShare.ToString().Replace(", ", "|");
try try