#include <unistd.h>
#include <signal.h>
#include <errno.h>
-#include <windows.h>
#include "../fio.h"
HANDLE iocp;
HANDLE iothread;
HANDLE iocomplete_event;
- CANCELIOEX pCancelIoEx;
BOOL iothread_running;
};
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);
+ unsigned int max, const struct timespec *t);
static struct io_u *fio_windowsaio_event(struct thread_data *td, int event);
static int fio_windowsaio_queue(struct thread_data *td,
struct io_u *io_u);
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));
}
}
- hKernel32Dll = GetModuleHandle("kernel32.dll");
- wd->pCancelIoEx = (CANCELIOEX)GetProcAddress(hKernel32Dll, "CancelIoEx");
td->io_ops->data = wd;
if (!rc) {
}
static int fio_windowsaio_getevents(struct thread_data *td, unsigned int min,
- unsigned int max, struct timespec *t)
+ unsigned int max,
+ const 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;
}
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) {
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;
.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,