Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 1 | /* |
Jens Axboe | da751ca | 2007-03-14 10:59:33 +0100 | [diff] [blame] | 2 | * syslet engine |
| 3 | * |
| 4 | * IO engine that does regular pread(2)/pwrite(2) to transfer data, but |
| 5 | * with syslets to make the execution async. |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 6 | * |
| 7 | */ |
| 8 | #include <stdio.h> |
| 9 | #include <stdlib.h> |
| 10 | #include <unistd.h> |
| 11 | #include <errno.h> |
| 12 | #include <assert.h> |
Jens Axboe | b884635 | 2007-03-14 14:29:16 +0100 | [diff] [blame] | 13 | #include <asm/unistd.h> |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 14 | |
| 15 | #include "../fio.h" |
| 16 | #include "../os.h" |
| 17 | |
| 18 | #ifdef FIO_HAVE_SYSLET |
| 19 | |
Jens Axboe | 1760e67 | 2007-03-14 20:41:42 +0100 | [diff] [blame] | 20 | #ifdef __NR_pread64 |
| 21 | #define __NR_fio_pread __NR_pread64 |
| 22 | #define __NR_fio_pwrite __NR_pwrite64 |
| 23 | #else |
| 24 | #define __NR_fio_pread __NR_pread |
| 25 | #define __NR_fio_pwrite __NR_pwrite |
| 26 | #endif |
| 27 | |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 28 | struct syslet_data { |
| 29 | struct io_u **events; |
| 30 | unsigned int nr_events; |
| 31 | |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 32 | struct async_head_user ahu; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 33 | struct syslet_uatom **ring; |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 34 | |
| 35 | struct syslet_uatom *head, *tail; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 36 | }; |
| 37 | |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 38 | static void fio_syslet_complete_atom(struct thread_data *td, |
| 39 | struct syslet_uatom *atom) |
| 40 | { |
| 41 | struct syslet_data *sd = td->io_ops->data; |
Jens Axboe | 5b38ee8 | 2007-02-26 10:44:22 +0100 | [diff] [blame] | 42 | struct syslet_uatom *last; |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 43 | struct io_u *io_u; |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 44 | |
| 45 | /* |
Jens Axboe | 5b38ee8 | 2007-02-26 10:44:22 +0100 | [diff] [blame] | 46 | * complete from the beginning of the sequence up to (and |
| 47 | * including) this atom |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 48 | */ |
Jens Axboe | 5b38ee8 | 2007-02-26 10:44:22 +0100 | [diff] [blame] | 49 | last = atom; |
| 50 | io_u = atom->private; |
| 51 | atom = io_u->req.head; |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 52 | |
| 53 | /* |
| 54 | * now complete in right order |
| 55 | */ |
Jens Axboe | 5b38ee8 | 2007-02-26 10:44:22 +0100 | [diff] [blame] | 56 | do { |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 57 | long ret; |
| 58 | |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 59 | io_u = atom->private; |
| 60 | ret = *atom->ret_ptr; |
Jens Axboe | e2e6791 | 2007-03-12 09:43:05 +0100 | [diff] [blame] | 61 | if (ret >= 0) |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 62 | io_u->resid = io_u->xfer_buflen - ret; |
| 63 | else if (ret < 0) |
| 64 | io_u->error = ret; |
| 65 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame^] | 66 | assert(sd->nr_events < td->o.iodepth); |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 67 | sd->events[sd->nr_events++] = io_u; |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 68 | |
Jens Axboe | 5b38ee8 | 2007-02-26 10:44:22 +0100 | [diff] [blame] | 69 | if (atom == last) |
| 70 | break; |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 71 | |
Jens Axboe | 5b38ee8 | 2007-02-26 10:44:22 +0100 | [diff] [blame] | 72 | atom = atom->next; |
| 73 | } while (1); |
| 74 | |
| 75 | assert(!last->next); |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 76 | } |
| 77 | |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 78 | /* |
| 79 | * Inspect the ring to see if we have completed events |
| 80 | */ |
| 81 | static void fio_syslet_complete(struct thread_data *td) |
| 82 | { |
| 83 | struct syslet_data *sd = td->io_ops->data; |
| 84 | |
| 85 | do { |
| 86 | struct syslet_uatom *atom; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 87 | |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 88 | atom = sd->ring[sd->ahu.user_ring_idx]; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 89 | if (!atom) |
| 90 | break; |
| 91 | |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 92 | sd->ring[sd->ahu.user_ring_idx] = NULL; |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame^] | 93 | if (++sd->ahu.user_ring_idx == td->o.iodepth) |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 94 | sd->ahu.user_ring_idx = 0; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 95 | |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 96 | fio_syslet_complete_atom(td, atom); |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 97 | } while (1); |
| 98 | } |
| 99 | |
| 100 | static int fio_syslet_getevents(struct thread_data *td, int min, |
| 101 | int fio_unused max, |
| 102 | struct timespec fio_unused *t) |
| 103 | { |
| 104 | struct syslet_data *sd = td->io_ops->data; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 105 | long ret; |
| 106 | |
| 107 | do { |
| 108 | fio_syslet_complete(td); |
| 109 | |
| 110 | /* |
| 111 | * do we have enough immediate completions? |
| 112 | */ |
| 113 | if (sd->nr_events >= (unsigned int) min) |
| 114 | break; |
| 115 | |
| 116 | /* |
| 117 | * OK, we need to wait for some events... |
| 118 | */ |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 119 | ret = async_wait(1, sd->ahu.user_ring_idx, &sd->ahu); |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 120 | if (ret < 0) |
Jens Axboe | e49499f | 2007-02-22 11:08:52 +0100 | [diff] [blame] | 121 | return -errno; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 122 | } while (1); |
| 123 | |
| 124 | ret = sd->nr_events; |
| 125 | sd->nr_events = 0; |
| 126 | return ret; |
| 127 | } |
| 128 | |
| 129 | static struct io_u *fio_syslet_event(struct thread_data *td, int event) |
| 130 | { |
| 131 | struct syslet_data *sd = td->io_ops->data; |
| 132 | |
| 133 | return sd->events[event]; |
| 134 | } |
| 135 | |
| 136 | static void init_atom(struct syslet_uatom *atom, int nr, void *arg0, |
Jens Axboe | a2e1b08 | 2007-02-14 08:06:19 +0100 | [diff] [blame] | 137 | void *arg1, void *arg2, void *arg3, void *ret_ptr, |
| 138 | unsigned long flags, void *priv) |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 139 | { |
| 140 | atom->flags = flags; |
| 141 | atom->nr = nr; |
| 142 | atom->ret_ptr = ret_ptr; |
Jens Axboe | a2e1b08 | 2007-02-14 08:06:19 +0100 | [diff] [blame] | 143 | atom->next = NULL; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 144 | atom->arg_ptr[0] = arg0; |
| 145 | atom->arg_ptr[1] = arg1; |
| 146 | atom->arg_ptr[2] = arg2; |
Jens Axboe | a2e1b08 | 2007-02-14 08:06:19 +0100 | [diff] [blame] | 147 | atom->arg_ptr[3] = arg3; |
| 148 | atom->arg_ptr[4] = atom->arg_ptr[5] = NULL; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 149 | atom->private = priv; |
| 150 | } |
| 151 | |
| 152 | /* |
| 153 | * Use seek atom for sync |
| 154 | */ |
| 155 | static void fio_syslet_prep_sync(struct io_u *io_u, struct fio_file *f) |
| 156 | { |
Jens Axboe | a2e1b08 | 2007-02-14 08:06:19 +0100 | [diff] [blame] | 157 | init_atom(&io_u->req.atom, __NR_fsync, &f->fd, NULL, NULL, NULL, |
Jens Axboe | 7d44a74 | 2007-02-14 17:32:08 +0100 | [diff] [blame] | 158 | &io_u->req.ret, 0, io_u); |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | static void fio_syslet_prep_rw(struct io_u *io_u, struct fio_file *f) |
| 162 | { |
| 163 | int nr; |
| 164 | |
| 165 | /* |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 166 | * prepare rw |
| 167 | */ |
| 168 | if (io_u->ddir == DDIR_READ) |
Jens Axboe | 1760e67 | 2007-03-14 20:41:42 +0100 | [diff] [blame] | 169 | nr = __NR_fio_pread; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 170 | else |
Jens Axboe | 1760e67 | 2007-03-14 20:41:42 +0100 | [diff] [blame] | 171 | nr = __NR_fio_pwrite; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 172 | |
Jens Axboe | a2e1b08 | 2007-02-14 08:06:19 +0100 | [diff] [blame] | 173 | init_atom(&io_u->req.atom, nr, &f->fd, &io_u->xfer_buf, |
Jens Axboe | 7d44a74 | 2007-02-14 17:32:08 +0100 | [diff] [blame] | 174 | &io_u->xfer_buflen, &io_u->offset, &io_u->req.ret, 0, io_u); |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | static int fio_syslet_prep(struct thread_data fio_unused *td, struct io_u *io_u) |
| 178 | { |
| 179 | struct fio_file *f = io_u->file; |
| 180 | |
| 181 | if (io_u->ddir == DDIR_SYNC) |
| 182 | fio_syslet_prep_sync(io_u, f); |
| 183 | else |
| 184 | fio_syslet_prep_rw(io_u, f); |
| 185 | |
| 186 | return 0; |
| 187 | } |
| 188 | |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 189 | static void cachemiss_thread_start(void) |
| 190 | { |
| 191 | while (1) |
Jens Axboe | 7756b0d | 2007-02-26 10:22:31 +0100 | [diff] [blame] | 192 | async_thread(NULL, NULL); |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | #define THREAD_STACK_SIZE (16384) |
| 196 | |
| 197 | static unsigned long thread_stack_alloc() |
| 198 | { |
Jens Axboe | 5b38ee8 | 2007-02-26 10:44:22 +0100 | [diff] [blame] | 199 | return (unsigned long) malloc(THREAD_STACK_SIZE) + THREAD_STACK_SIZE; |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 200 | } |
| 201 | |
Jens Axboe | a0a930e | 2007-02-27 19:47:13 +0100 | [diff] [blame] | 202 | static void fio_syslet_queued(struct thread_data *td, struct syslet_data *sd) |
| 203 | { |
| 204 | struct syslet_uatom *atom; |
| 205 | struct timeval now; |
| 206 | |
| 207 | fio_gettime(&now, NULL); |
| 208 | |
| 209 | atom = sd->head; |
| 210 | while (atom) { |
| 211 | struct io_u *io_u = atom->private; |
| 212 | |
| 213 | memcpy(&io_u->issue_time, &now, sizeof(now)); |
| 214 | io_u_queued(td, io_u); |
| 215 | atom = atom->next; |
| 216 | } |
| 217 | } |
| 218 | |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 219 | static int fio_syslet_commit(struct thread_data *td) |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 220 | { |
| 221 | struct syslet_data *sd = td->io_ops->data; |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 222 | struct syslet_uatom *done; |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 223 | |
| 224 | if (!sd->head) |
| 225 | return 0; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 226 | |
Jens Axboe | 5b38ee8 | 2007-02-26 10:44:22 +0100 | [diff] [blame] | 227 | assert(!sd->tail->next); |
| 228 | |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 229 | if (!sd->ahu.new_thread_stack) |
| 230 | sd->ahu.new_thread_stack = thread_stack_alloc(); |
| 231 | |
Jens Axboe | a0a930e | 2007-02-27 19:47:13 +0100 | [diff] [blame] | 232 | fio_syslet_queued(td, sd); |
| 233 | |
Jens Axboe | 7d44a74 | 2007-02-14 17:32:08 +0100 | [diff] [blame] | 234 | /* |
| 235 | * On sync completion, the atom is returned. So on NULL return |
| 236 | * it's queued asynchronously. |
| 237 | */ |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 238 | done = async_exec(sd->head, &sd->ahu); |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 239 | |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 240 | sd->head = sd->tail = NULL; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 241 | |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 242 | if (done) |
| 243 | fio_syslet_complete_atom(td, done); |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 244 | |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 245 | return 0; |
| 246 | } |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 247 | |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 248 | static int fio_syslet_queue(struct thread_data *td, struct io_u *io_u) |
| 249 | { |
| 250 | struct syslet_data *sd = td->io_ops->data; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 251 | |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 252 | if (sd->tail) { |
| 253 | sd->tail->next = &io_u->req.atom; |
| 254 | sd->tail = &io_u->req.atom; |
| 255 | } else |
| 256 | sd->head = sd->tail = &io_u->req.atom; |
| 257 | |
Jens Axboe | 5b38ee8 | 2007-02-26 10:44:22 +0100 | [diff] [blame] | 258 | io_u->req.head = sd->head; |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 259 | return FIO_Q_QUEUED; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 260 | } |
| 261 | |
Jens Axboe | db64e9b | 2007-02-14 02:10:59 +0100 | [diff] [blame] | 262 | static int async_head_init(struct syslet_data *sd, unsigned int depth) |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 263 | { |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 264 | unsigned long ring_size; |
| 265 | |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 266 | memset(&sd->ahu, 0, sizeof(struct async_head_user)); |
Jens Axboe | 2ca50be | 2007-02-14 08:31:15 +0100 | [diff] [blame] | 267 | |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 268 | ring_size = sizeof(struct syslet_uatom *) * depth; |
| 269 | sd->ring = malloc(ring_size); |
| 270 | memset(sd->ring, 0, ring_size); |
| 271 | |
Ingo Molnar | bf0dc8f | 2007-02-21 23:25:44 +0100 | [diff] [blame] | 272 | sd->ahu.user_ring_idx = 0; |
| 273 | sd->ahu.completion_ring = sd->ring; |
| 274 | sd->ahu.ring_size_bytes = ring_size; |
| 275 | sd->ahu.head_stack = thread_stack_alloc(); |
Jens Axboe | 5b38ee8 | 2007-02-26 10:44:22 +0100 | [diff] [blame] | 276 | sd->ahu.head_eip = (unsigned long) cachemiss_thread_start; |
| 277 | sd->ahu.new_thread_eip = (unsigned long) cachemiss_thread_start; |
Jens Axboe | db64e9b | 2007-02-14 02:10:59 +0100 | [diff] [blame] | 278 | |
| 279 | return 0; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 280 | } |
| 281 | |
Jens Axboe | 2ca50be | 2007-02-14 08:31:15 +0100 | [diff] [blame] | 282 | static void async_head_exit(struct syslet_data *sd) |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 283 | { |
Jens Axboe | 7f059a7 | 2007-02-14 08:53:11 +0100 | [diff] [blame] | 284 | free(sd->ring); |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | static void fio_syslet_cleanup(struct thread_data *td) |
| 288 | { |
| 289 | struct syslet_data *sd = td->io_ops->data; |
| 290 | |
| 291 | if (sd) { |
Jens Axboe | 2ca50be | 2007-02-14 08:31:15 +0100 | [diff] [blame] | 292 | async_head_exit(sd); |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 293 | free(sd->events); |
| 294 | free(sd); |
| 295 | td->io_ops->data = NULL; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | static int fio_syslet_init(struct thread_data *td) |
| 300 | { |
| 301 | struct syslet_data *sd; |
| 302 | |
Jens Axboe | db64e9b | 2007-02-14 02:10:59 +0100 | [diff] [blame] | 303 | |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 304 | sd = malloc(sizeof(*sd)); |
| 305 | memset(sd, 0, sizeof(*sd)); |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame^] | 306 | sd->events = malloc(sizeof(struct io_u *) * td->o.iodepth); |
| 307 | memset(sd->events, 0, sizeof(struct io_u *) * td->o.iodepth); |
Jens Axboe | db64e9b | 2007-02-14 02:10:59 +0100 | [diff] [blame] | 308 | |
| 309 | /* |
| 310 | * This will handily fail for kernels where syslet isn't available |
| 311 | */ |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame^] | 312 | if (async_head_init(sd, td->o.iodepth)) { |
Jens Axboe | db64e9b | 2007-02-14 02:10:59 +0100 | [diff] [blame] | 313 | free(sd->events); |
| 314 | free(sd); |
| 315 | return 1; |
| 316 | } |
| 317 | |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 318 | td->io_ops->data = sd; |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 319 | return 0; |
| 320 | } |
| 321 | |
| 322 | static struct ioengine_ops ioengine = { |
| 323 | .name = "syslet-rw", |
| 324 | .version = FIO_IOOPS_VERSION, |
| 325 | .init = fio_syslet_init, |
| 326 | .prep = fio_syslet_prep, |
| 327 | .queue = fio_syslet_queue, |
Jens Axboe | 9ff9de6 | 2007-02-23 13:21:45 +0100 | [diff] [blame] | 328 | .commit = fio_syslet_commit, |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 329 | .getevents = fio_syslet_getevents, |
| 330 | .event = fio_syslet_event, |
| 331 | .cleanup = fio_syslet_cleanup, |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 332 | .open_file = generic_open_file, |
| 333 | .close_file = generic_close_file, |
Jens Axboe | a4f4fdd | 2007-02-14 01:16:39 +0100 | [diff] [blame] | 334 | }; |
| 335 | |
| 336 | #else /* FIO_HAVE_SYSLET */ |
| 337 | |
| 338 | /* |
| 339 | * When we have a proper configure system in place, we simply wont build |
| 340 | * and install this io engine. For now install a crippled version that |
| 341 | * just complains and fails to load. |
| 342 | */ |
| 343 | static int fio_syslet_init(struct thread_data fio_unused *td) |
| 344 | { |
| 345 | fprintf(stderr, "fio: syslet not available\n"); |
| 346 | return 1; |
| 347 | } |
| 348 | |
| 349 | static struct ioengine_ops ioengine = { |
| 350 | .name = "syslet-rw", |
| 351 | .version = FIO_IOOPS_VERSION, |
| 352 | .init = fio_syslet_init, |
| 353 | }; |
| 354 | |
| 355 | #endif /* FIO_HAVE_SYSLET */ |
| 356 | |
| 357 | static void fio_init fio_syslet_register(void) |
| 358 | { |
| 359 | register_ioengine(&ioengine); |
| 360 | } |
| 361 | |
| 362 | static void fio_exit fio_syslet_unregister(void) |
| 363 | { |
| 364 | unregister_ioengine(&ioengine); |
| 365 | } |