[MDEV-11264] Windows : incorrect use of DeviceIoControl in os_file_trim Created: 2016-11-09 Updated: 2017-05-23 Resolved: 2017-05-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - XtraDB |
| Affects Version/s: | 10.1 |
| Fix Version/s: | 10.1.24 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladislav Vaintroub | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Sprint: | 10.1.24 |
| Comments |
| Comment by Vladislav Vaintroub [ 2016-11-09 ] |
|
os_file_trim implements TRIM on Windows with DeviceIoControl(FSCTL_FILE_LEVEL_TRIM). However is does not use DeviceIoControl correctly - since file is opened asynchronously, DeviceIoControl needs to be async as well - it to be passed valid OVERLAPPED as the last parameter. MSDN says in the documentation of DeviceIoControl - https://msdn.microsoft.com/en-us/library/windows/desktop/aa363216(v=vs.85).aspx "If hDevice was opened without specifying FILE_FLAG_OVERLAPPED, lpOverlapped is ignored. If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, the operation is performed as an overlapped (asynchronous) operation. In this case, lpOverlapped must point to a valid OVERLAPPED structure that contains a handle to an event object. Otherwise, the function fails in unpredictable ways. |