X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Fwindowsaio.c;h=16df74035f189e15c3811755b68285795f694aaa;hb=e53cf97beb6c07ea1dedc218058675cc291e9f2a;hp=3a24fa717da7d3751a616e7a17b338cc9bd5a38f;hpb=10a6b3c67042914fe9d287027bf8792f69e84524;p=fio.git diff --git a/engines/windowsaio.c b/engines/windowsaio.c index 3a24fa71..16df7403 100644 --- a/engines/windowsaio.c +++ b/engines/windowsaio.c @@ -9,7 +9,6 @@ #include #include #include -#include #include "../fio.h" @@ -28,7 +27,6 @@ struct windowsaio_data { HANDLE iocp; HANDLE iothread; HANDLE iocomplete_event; - CANCELIOEX pCancelIoEx; BOOL iothread_running; }; @@ -37,8 +35,6 @@ struct thread_ctx { struct windowsaio_data *wd; }; -static int fio_windowsaio_cancel(struct thread_data *td, - struct io_u *io_u); static BOOL timeout_expired(DWORD start_count, DWORD end_count); static int fio_windowsaio_getevents(struct thread_data *td, unsigned int min, unsigned int max, struct timespec *t); @@ -54,7 +50,6 @@ static int fio_windowsaio_close_file(struct thread_data fio_unused *td, struct f static int fio_windowsaio_init(struct thread_data *td) { struct windowsaio_data *wd; - HANDLE hKernel32Dll; int rc = 0; wd = calloc(1, sizeof(struct windowsaio_data)); @@ -89,8 +84,6 @@ static int fio_windowsaio_init(struct thread_data *td) } } - hKernel32Dll = GetModuleHandle("kernel32.dll"); - wd->pCancelIoEx = (CANCELIOEX)GetProcAddress(hKernel32Dll, "CancelIoEx"); td->io_ops->data = wd; if (!rc) { @@ -266,9 +259,9 @@ static int fio_windowsaio_getevents(struct thread_data *td, unsigned int min, unsigned int max, struct timespec *t) { struct windowsaio_data *wd = td->io_ops->data; - struct flist_head *entry; unsigned int dequeued = 0; struct io_u *io_u; + int i; struct fio_overlapped *fov; DWORD start_count = 0; DWORD end_count = 0; @@ -282,8 +275,10 @@ static int fio_windowsaio_getevents(struct thread_data *td, unsigned int min, } do { - flist_for_each(entry, &td->io_u_busylist) { - io_u = flist_entry(entry, struct io_u, list); + io_u_qiter(&td->io_u_all, io_u, i) { + if (!(io_u->flags & IO_U_F_FLIGHT)) + continue; + fov = (struct fio_overlapped*)io_u->engine_data; if (fov->io_complete) { @@ -402,27 +397,6 @@ static DWORD WINAPI IoCompletionRoutine(LPVOID lpParameter) return 0; } -static int fio_windowsaio_cancel(struct thread_data *td, - struct io_u *io_u) -{ - int rc = 0; - - struct windowsaio_data *wd = td->io_ops->data; - - /* If we're running on Vista or newer, we can cancel individual IO requests */ - if (wd->pCancelIoEx != NULL) { - struct fio_overlapped *ovl = io_u->engine_data; - - if (!wd->pCancelIoEx(io_u->file->hFile, &ovl->o)) { - log_err("windowsaio: failed to cancel io\n"); - rc = 1; - } - } else - rc = 1; - - return rc; -} - static void fio_windowsaio_io_u_free(struct thread_data *td, struct io_u *io_u) { struct fio_overlapped *o = io_u->engine_data; @@ -457,7 +431,6 @@ static struct ioengine_ops ioengine = { .version = FIO_IOOPS_VERSION, .init = fio_windowsaio_init, .queue = fio_windowsaio_queue, - .cancel = fio_windowsaio_cancel, .getevents = fio_windowsaio_getevents, .event = fio_windowsaio_event, .cleanup = fio_windowsaio_cleanup,