Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 1 | /* |
Jens Axboe | da751ca | 2007-03-14 10:59:33 +0100 | [diff] [blame^] | 2 | * net engine |
| 3 | * |
| 4 | * IO engine that reads/writes to/from sockets. |
| 5 | * |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 6 | */ |
| 7 | #include <stdio.h> |
| 8 | #include <stdlib.h> |
| 9 | #include <unistd.h> |
| 10 | #include <errno.h> |
| 11 | #include <assert.h> |
| 12 | #include <netinet/in.h> |
| 13 | #include <arpa/inet.h> |
| 14 | #include <netdb.h> |
Jens Axboe | 5fdd124 | 2007-02-11 04:00:37 +0100 | [diff] [blame] | 15 | #include <sys/poll.h> |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 16 | |
| 17 | #include "../fio.h" |
| 18 | #include "../os.h" |
| 19 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 20 | struct netio_data { |
| 21 | int listenfd; |
| 22 | int send_to_net; |
| 23 | char host[64]; |
| 24 | struct sockaddr_in addr; |
| 25 | }; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 26 | |
| 27 | static int fio_netio_prep(struct thread_data *td, struct io_u *io_u) |
| 28 | { |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 29 | struct netio_data *nd = td->io_ops->data; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 30 | struct fio_file *f = io_u->file; |
| 31 | |
Jens Axboe | 7a6499d | 2007-02-07 09:35:29 +0100 | [diff] [blame] | 32 | /* |
| 33 | * Make sure we don't see spurious reads to a receiver, and vice versa |
| 34 | */ |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 35 | if ((nd->send_to_net && io_u->ddir == DDIR_READ) || |
| 36 | (!nd->send_to_net && io_u->ddir == DDIR_WRITE)) { |
Jens Axboe | e1161c3 | 2007-02-22 19:36:48 +0100 | [diff] [blame] | 37 | td_verror(td, EINVAL, "bad direction"); |
Jens Axboe | 7a6499d | 2007-02-07 09:35:29 +0100 | [diff] [blame] | 38 | return 1; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 39 | } |
Jens Axboe | 7a6499d | 2007-02-07 09:35:29 +0100 | [diff] [blame] | 40 | |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 41 | if (io_u->ddir == DDIR_SYNC) |
| 42 | return 0; |
| 43 | if (io_u->offset == f->last_completed_pos) |
| 44 | return 0; |
| 45 | |
Jens Axboe | e01547d | 2007-02-06 19:16:01 +0100 | [diff] [blame] | 46 | /* |
| 47 | * If offset is different from last end position, it's a seek. |
| 48 | * As network io is purely sequential, we don't allow seeks. |
| 49 | */ |
Jens Axboe | e1161c3 | 2007-02-22 19:36:48 +0100 | [diff] [blame] | 50 | td_verror(td, EINVAL, "cannot seek"); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 51 | return 1; |
| 52 | } |
| 53 | |
| 54 | static int fio_netio_queue(struct thread_data *td, struct io_u *io_u) |
| 55 | { |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 56 | struct fio_file *f = io_u->file; |
Jens Axboe | d4f12dd | 2007-02-08 12:59:02 +0100 | [diff] [blame] | 57 | int ret, flags = 0; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 58 | |
Jens Axboe | 7a6499d | 2007-02-07 09:35:29 +0100 | [diff] [blame] | 59 | if (io_u->ddir == DDIR_WRITE) { |
Jens Axboe | 7a6499d | 2007-02-07 09:35:29 +0100 | [diff] [blame] | 60 | /* |
| 61 | * if we are going to write more, set MSG_MORE |
| 62 | */ |
| 63 | if (td->this_io_bytes[DDIR_WRITE] + io_u->xfer_buflen < |
| 64 | td->io_size) |
| 65 | flags = MSG_MORE; |
| 66 | |
| 67 | ret = send(f->fd, io_u->xfer_buf, io_u->xfer_buflen, flags); |
Jens Axboe | d4f12dd | 2007-02-08 12:59:02 +0100 | [diff] [blame] | 68 | } else if (io_u->ddir == DDIR_READ) { |
| 69 | flags = MSG_WAITALL; |
| 70 | ret = recv(f->fd, io_u->xfer_buf, io_u->xfer_buflen, flags); |
| 71 | } else |
Jens Axboe | 7a6499d | 2007-02-07 09:35:29 +0100 | [diff] [blame] | 72 | ret = 0; /* must be a SYNC */ |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 73 | |
Jens Axboe | cec6b55 | 2007-02-06 20:15:38 +0100 | [diff] [blame] | 74 | if (ret != (int) io_u->xfer_buflen) { |
Jens Axboe | 22819ec | 2007-02-18 07:47:14 +0100 | [diff] [blame] | 75 | if (ret >= 0) { |
Jens Axboe | cec6b55 | 2007-02-06 20:15:38 +0100 | [diff] [blame] | 76 | io_u->resid = io_u->xfer_buflen - ret; |
| 77 | io_u->error = 0; |
Jens Axboe | 36167d8 | 2007-02-18 05:41:31 +0100 | [diff] [blame] | 78 | return FIO_Q_COMPLETED; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 79 | } else |
| 80 | io_u->error = errno; |
| 81 | } |
| 82 | |
Jens Axboe | 36167d8 | 2007-02-18 05:41:31 +0100 | [diff] [blame] | 83 | if (io_u->error) |
Jens Axboe | e1161c3 | 2007-02-22 19:36:48 +0100 | [diff] [blame] | 84 | td_verror(td, io_u->error, "xfer"); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 85 | |
Jens Axboe | 36167d8 | 2007-02-18 05:41:31 +0100 | [diff] [blame] | 86 | return FIO_Q_COMPLETED; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 87 | } |
| 88 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 89 | static int fio_netio_connect(struct thread_data *td, struct fio_file *f) |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 90 | { |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 91 | struct netio_data *nd = td->io_ops->data; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 92 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 93 | f->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
| 94 | if (f->fd < 0) { |
| 95 | td_verror(td, errno, "socket"); |
| 96 | return 1; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 97 | } |
| 98 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 99 | if (connect(f->fd, (struct sockaddr *) &nd->addr, sizeof(nd->addr)) < 0) { |
| 100 | td_verror(td, errno, "connect"); |
| 101 | return 1; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | return 0; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 105 | } |
| 106 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 107 | static int fio_netio_accept(struct thread_data *td, struct fio_file *f) |
Jens Axboe | 5fdd124 | 2007-02-11 04:00:37 +0100 | [diff] [blame] | 108 | { |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 109 | struct netio_data *nd = td->io_ops->data; |
| 110 | socklen_t socklen = sizeof(nd->addr); |
Jens Axboe | 5fdd124 | 2007-02-11 04:00:37 +0100 | [diff] [blame] | 111 | struct pollfd pfd; |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 112 | int ret; |
Jens Axboe | 5fdd124 | 2007-02-11 04:00:37 +0100 | [diff] [blame] | 113 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 114 | fprintf(f_out, "fio: waiting for connection\n"); |
Jens Axboe | 5fdd124 | 2007-02-11 04:00:37 +0100 | [diff] [blame] | 115 | |
| 116 | /* |
| 117 | * Accept loop. poll for incoming events, accept them. Repeat until we |
| 118 | * have all connections. |
| 119 | */ |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 120 | while (!td->terminate) { |
| 121 | pfd.fd = nd->listenfd; |
Jens Axboe | 5fdd124 | 2007-02-11 04:00:37 +0100 | [diff] [blame] | 122 | pfd.events = POLLIN; |
| 123 | |
| 124 | ret = poll(&pfd, 1, -1); |
| 125 | if (ret < 0) { |
| 126 | if (errno == EINTR) |
| 127 | continue; |
| 128 | |
Jens Axboe | e1161c3 | 2007-02-22 19:36:48 +0100 | [diff] [blame] | 129 | td_verror(td, errno, "poll"); |
Jens Axboe | 5fdd124 | 2007-02-11 04:00:37 +0100 | [diff] [blame] | 130 | break; |
| 131 | } else if (!ret) |
| 132 | continue; |
| 133 | |
Jens Axboe | 0c09442 | 2007-02-11 04:44:02 +0100 | [diff] [blame] | 134 | /* |
| 135 | * should be impossible |
| 136 | */ |
| 137 | if (!(pfd.revents & POLLIN)) |
| 138 | continue; |
| 139 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 140 | f->fd = accept(nd->listenfd, (struct sockaddr *) &nd->addr, &socklen); |
| 141 | if (f->fd < 0) { |
| 142 | td_verror(td, errno, "accept"); |
| 143 | return 1; |
Jens Axboe | 5fdd124 | 2007-02-11 04:00:37 +0100 | [diff] [blame] | 144 | } |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 145 | break; |
Jens Axboe | 5fdd124 | 2007-02-11 04:00:37 +0100 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | return 0; |
| 149 | } |
| 150 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 151 | |
| 152 | static int fio_netio_open_file(struct thread_data *td, struct fio_file *f) |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 153 | { |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 154 | if (td_read(td)) |
| 155 | return fio_netio_accept(td, f); |
| 156 | else |
| 157 | return fio_netio_connect(td, f); |
| 158 | } |
| 159 | |
| 160 | static int fio_netio_setup_connect(struct thread_data *td, const char *host, |
| 161 | unsigned short port) |
| 162 | { |
| 163 | struct netio_data *nd = td->io_ops->data; |
| 164 | |
| 165 | nd->addr.sin_family = AF_INET; |
| 166 | nd->addr.sin_port = htons(port); |
| 167 | |
| 168 | if (inet_aton(host, &nd->addr.sin_addr) != 1) { |
| 169 | struct hostent *hent; |
| 170 | |
| 171 | hent = gethostbyname(host); |
| 172 | if (!hent) { |
| 173 | td_verror(td, errno, "gethostbyname"); |
| 174 | return 1; |
| 175 | } |
| 176 | |
| 177 | memcpy(&nd->addr.sin_addr, hent->h_addr, 4); |
| 178 | } |
| 179 | |
| 180 | return 0; |
| 181 | } |
| 182 | |
| 183 | static int fio_netio_setup_listen(struct thread_data *td, short port) |
| 184 | { |
| 185 | struct netio_data *nd = td->io_ops->data; |
Jens Axboe | 5fdd124 | 2007-02-11 04:00:37 +0100 | [diff] [blame] | 186 | int fd, opt; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 187 | |
Jens Axboe | 6bedbfa | 2007-02-07 09:54:40 +0100 | [diff] [blame] | 188 | fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 189 | if (fd < 0) { |
Jens Axboe | e1161c3 | 2007-02-22 19:36:48 +0100 | [diff] [blame] | 190 | td_verror(td, errno, "socket"); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 191 | return 1; |
| 192 | } |
| 193 | |
| 194 | opt = 1; |
| 195 | if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) { |
Jens Axboe | e1161c3 | 2007-02-22 19:36:48 +0100 | [diff] [blame] | 196 | td_verror(td, errno, "setsockopt"); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 197 | return 1; |
| 198 | } |
Jens Axboe | 6bedbfa | 2007-02-07 09:54:40 +0100 | [diff] [blame] | 199 | #ifdef SO_REUSEPORT |
| 200 | if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)) < 0) { |
Jens Axboe | e1161c3 | 2007-02-22 19:36:48 +0100 | [diff] [blame] | 201 | td_verror(td, errno, "setsockopt"); |
Jens Axboe | 6bedbfa | 2007-02-07 09:54:40 +0100 | [diff] [blame] | 202 | return 1; |
| 203 | } |
| 204 | #endif |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 205 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 206 | nd->addr.sin_family = AF_INET; |
| 207 | nd->addr.sin_addr.s_addr = htonl(INADDR_ANY); |
| 208 | nd->addr.sin_port = htons(port); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 209 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 210 | if (bind(fd, (struct sockaddr *) &nd->addr, sizeof(nd->addr)) < 0) { |
Jens Axboe | e1161c3 | 2007-02-22 19:36:48 +0100 | [diff] [blame] | 211 | td_verror(td, errno, "bind"); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 212 | return 1; |
| 213 | } |
| 214 | if (listen(fd, 1) < 0) { |
Jens Axboe | e1161c3 | 2007-02-22 19:36:48 +0100 | [diff] [blame] | 215 | td_verror(td, errno, "listen"); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 216 | return 1; |
| 217 | } |
| 218 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 219 | nd->listenfd = fd; |
| 220 | return 0; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 221 | } |
| 222 | |
Jens Axboe | 9bec88e | 2007-03-02 08:55:48 +0100 | [diff] [blame] | 223 | static int fio_netio_init(struct thread_data *td) |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 224 | { |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 225 | struct netio_data *nd = td->io_ops->data; |
Jens Axboe | e01547d | 2007-02-06 19:16:01 +0100 | [diff] [blame] | 226 | unsigned short port; |
Jens Axboe | 2fc2698 | 2007-02-06 19:27:27 +0100 | [diff] [blame] | 227 | struct fio_file *f; |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 228 | char host[64], buf[128]; |
Jens Axboe | af52b34 | 2007-03-13 10:07:47 +0100 | [diff] [blame] | 229 | unsigned int i; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 230 | char *sep; |
Jens Axboe | af52b34 | 2007-03-13 10:07:47 +0100 | [diff] [blame] | 231 | int ret; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 232 | |
Jens Axboe | 7a6499d | 2007-02-07 09:35:29 +0100 | [diff] [blame] | 233 | if (!td->total_file_size) { |
| 234 | log_err("fio: need size= set\n"); |
| 235 | return 1; |
| 236 | } |
| 237 | |
Jens Axboe | 413dd45 | 2007-02-23 09:26:09 +0100 | [diff] [blame] | 238 | if (td_rw(td)) { |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 239 | log_err("fio: network connections must be read OR write\n"); |
| 240 | return 1; |
| 241 | } |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 242 | |
| 243 | strcpy(buf, td->filename); |
| 244 | |
Jens Axboe | 9f9214f | 2007-03-13 14:02:16 +0100 | [diff] [blame] | 245 | sep = strchr(buf, '/'); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 246 | if (!sep) { |
Jens Axboe | 9f9214f | 2007-03-13 14:02:16 +0100 | [diff] [blame] | 247 | log_err("fio: bad network host/port <<%s>>\n", td->filename); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 248 | return 1; |
| 249 | } |
| 250 | |
| 251 | *sep = '\0'; |
| 252 | sep++; |
| 253 | strcpy(host, buf); |
Jens Axboe | e01547d | 2007-02-06 19:16:01 +0100 | [diff] [blame] | 254 | port = atoi(sep); |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 255 | |
Jens Axboe | 413dd45 | 2007-02-23 09:26:09 +0100 | [diff] [blame] | 256 | if (td_read(td)) { |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 257 | nd->send_to_net = 0; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 258 | ret = fio_netio_setup_listen(td, port); |
| 259 | } else { |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 260 | nd->send_to_net = 1; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 261 | ret = fio_netio_setup_connect(td, host, port); |
| 262 | } |
| 263 | |
Jens Axboe | 2fc2698 | 2007-02-06 19:27:27 +0100 | [diff] [blame] | 264 | if (ret) |
| 265 | return ret; |
| 266 | |
| 267 | td->io_size = td->total_file_size; |
| 268 | td->total_io_size = td->io_size; |
| 269 | |
| 270 | for_each_file(td, f, i) { |
| 271 | f->file_size = td->total_file_size / td->nr_files; |
| 272 | f->real_file_size = f->file_size; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 273 | } |
| 274 | |
Jens Axboe | 2fc2698 | 2007-02-06 19:27:27 +0100 | [diff] [blame] | 275 | return 0; |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 276 | } |
| 277 | |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 278 | static void fio_netio_cleanup(struct thread_data *td) |
Jens Axboe | 9bec88e | 2007-03-02 08:55:48 +0100 | [diff] [blame] | 279 | { |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 280 | struct netio_data *nd = td->io_ops->data; |
| 281 | |
| 282 | if (nd) { |
| 283 | free(nd); |
| 284 | td->io_ops->data = NULL; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | static int fio_netio_setup(struct thread_data *td) |
| 289 | { |
| 290 | struct netio_data *nd = malloc(sizeof(*nd)); |
| 291 | |
| 292 | memset(nd, 0, sizeof(*nd)); |
| 293 | nd->listenfd = -1; |
| 294 | td->io_ops->data = nd; |
Jens Axboe | 9bec88e | 2007-03-02 08:55:48 +0100 | [diff] [blame] | 295 | return 0; |
| 296 | } |
| 297 | |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 298 | static struct ioengine_ops ioengine = { |
| 299 | .name = "net", |
| 300 | .version = FIO_IOOPS_VERSION, |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 301 | .prep = fio_netio_prep, |
| 302 | .queue = fio_netio_queue, |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 303 | .setup = fio_netio_setup, |
Jens Axboe | 9bec88e | 2007-03-02 08:55:48 +0100 | [diff] [blame] | 304 | .init = fio_netio_init, |
Jens Axboe | b5af829 | 2007-03-08 12:43:13 +0100 | [diff] [blame] | 305 | .cleanup = fio_netio_cleanup, |
| 306 | .open_file = fio_netio_open_file, |
| 307 | .close_file = generic_close_file, |
| 308 | .flags = FIO_SYNCIO | FIO_DISKLESSIO, |
Jens Axboe | ed92ac0 | 2007-02-06 14:43:52 +0100 | [diff] [blame] | 309 | }; |
| 310 | |
| 311 | static void fio_init fio_netio_register(void) |
| 312 | { |
| 313 | register_ioengine(&ioengine); |
| 314 | } |
| 315 | |
| 316 | static void fio_exit fio_netio_unregister(void) |
| 317 | { |
| 318 | unregister_ioengine(&ioengine); |
| 319 | } |