diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2017-10-09 17:41:20 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2017-10-10 06:19:50 +0000 |
commit | fa7a1a57d9d73c0b834c86c9f366dab66b16a908 (patch) | |
tree | b3ec7f77e649297481983ec4ee9a4cbad9689122 | |
parent | ff2d9e125f7f2a70f67bc4e7ad40990139a1cf66 (diff) | |
download | mariadb-git-fa7a1a57d9d73c0b834c86c9f366dab66b16a908.tar.gz |
Windows : small optimization in os_is_sparse_file_supported()
Use GetFileInformationByHandleEx with FileAttributeTagInfo to query whether
the file is sparse. This saves 1 syscall, as GetFileInformationByHandle()
would additionally query volume info.
-rw-r--r-- | storage/innobase/os/os0file.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 2ef1940fdcd..b5c6381537e 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -5639,10 +5639,11 @@ os_is_sparse_file_supported(os_file_t fh) ); #ifdef _WIN32 - BY_HANDLE_FILE_INFORMATION info; - if (GetFileInformationByHandle(fh,&info)) { - if (info.dwFileAttributes != INVALID_FILE_ATTRIBUTES) { - return (info.dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) != 0; + FILE_ATTRIBUTE_TAG_INFO info; + if (GetFileInformationByHandleEx(fh, FileAttributeTagInfo, + &info, (DWORD)sizeof(info))) { + if (info.FileAttributes != INVALID_FILE_ATTRIBUTES) { + return (info.FileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) != 0; } } return false; |