blob: 60d53bc27a5bda48a9996185b03dc844e9cc631e [file] [log] [blame]
Jens Axboeed92ac02007-02-06 14:43:52 +01001/*
Jens Axboeda751ca2007-03-14 10:59:33 +01002 * net engine
3 *
4 * IO engine that reads/writes to/from sockets.
5 *
Jens Axboeed92ac02007-02-06 14:43:52 +01006 */
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 Axboe5fdd1242007-02-11 04:00:37 +010015#include <sys/poll.h>
Jens Axboeed92ac02007-02-06 14:43:52 +010016
17#include "../fio.h"
Jens Axboeed92ac02007-02-06 14:43:52 +010018
Jens Axboeb5af8292007-03-08 12:43:13 +010019struct netio_data {
20 int listenfd;
21 int send_to_net;
Jens Axboe9cce02e2007-06-22 15:42:21 +020022 int use_splice;
23 int pipes[2];
Jens Axboeb5af8292007-03-08 12:43:13 +010024 char host[64];
25 struct sockaddr_in addr;
26};
Jens Axboeed92ac02007-02-06 14:43:52 +010027
28static int fio_netio_prep(struct thread_data *td, struct io_u *io_u)
29{
Jens Axboeb5af8292007-03-08 12:43:13 +010030 struct netio_data *nd = td->io_ops->data;
Jens Axboeed92ac02007-02-06 14:43:52 +010031
Jens Axboe7a6499d2007-02-07 09:35:29 +010032 /*
33 * Make sure we don't see spurious reads to a receiver, and vice versa
34 */
Jens Axboeb5af8292007-03-08 12:43:13 +010035 if ((nd->send_to_net && io_u->ddir == DDIR_READ) ||
36 (!nd->send_to_net && io_u->ddir == DDIR_WRITE)) {
Jens Axboee1161c32007-02-22 19:36:48 +010037 td_verror(td, EINVAL, "bad direction");
Jens Axboe7a6499d2007-02-07 09:35:29 +010038 return 1;
Jens Axboeed92ac02007-02-06 14:43:52 +010039 }
Jens Axboe7a6499d2007-02-07 09:35:29 +010040
Jens Axboef85ac252008-03-01 18:09:49 +010041 return 0;
Jens Axboeed92ac02007-02-06 14:43:52 +010042}
43
Jens Axboecd963e12007-06-24 21:41:46 +020044static int splice_io_u(int fdin, int fdout, unsigned int len)
Jens Axboe9cce02e2007-06-22 15:42:21 +020045{
Jens Axboe9cce02e2007-06-22 15:42:21 +020046 int bytes = 0;
47
48 while (len) {
Jens Axboecd963e12007-06-24 21:41:46 +020049 int ret = splice(fdin, NULL, fdout, NULL, len, 0);
Jens Axboe9cce02e2007-06-22 15:42:21 +020050
51 if (ret < 0) {
52 if (!bytes)
53 bytes = ret;
54
55 break;
56 } else if (!ret)
57 break;
58
59 bytes += ret;
Jens Axboef657a2f2007-06-22 20:40:10 +020060 len -= ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +020061 }
62
63 return bytes;
64}
65
66/*
Jens Axboecd963e12007-06-24 21:41:46 +020067 * Receive bytes from a socket and fill them into the internal pipe
68 */
69static int splice_in(struct thread_data *td, struct io_u *io_u)
70{
71 struct netio_data *nd = td->io_ops->data;
72
73 return splice_io_u(io_u->file->fd, nd->pipes[1], io_u->xfer_buflen);
74}
75
76/*
Jens Axboe9cce02e2007-06-22 15:42:21 +020077 * Transmit 'len' bytes from the internal pipe
78 */
79static int splice_out(struct thread_data *td, struct io_u *io_u,
80 unsigned int len)
81{
82 struct netio_data *nd = td->io_ops->data;
Jens Axboecd963e12007-06-24 21:41:46 +020083
84 return splice_io_u(nd->pipes[0], io_u->file->fd, len);
85}
86
87static int vmsplice_io_u(struct io_u *io_u, int fd, unsigned int len)
88{
89 struct iovec iov = {
90 .iov_base = io_u->xfer_buf,
91 .iov_len = len,
92 };
Jens Axboe9cce02e2007-06-22 15:42:21 +020093 int bytes = 0;
94
Jens Axboecd963e12007-06-24 21:41:46 +020095 while (iov.iov_len) {
96 int ret = vmsplice(fd, &iov, 1, SPLICE_F_MOVE);
Jens Axboe9cce02e2007-06-22 15:42:21 +020097
98 if (ret < 0) {
99 if (!bytes)
100 bytes = ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200101 break;
102 } else if (!ret)
103 break;
104
Jens Axboecd963e12007-06-24 21:41:46 +0200105 iov.iov_len -= ret;
106 iov.iov_base += ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200107 bytes += ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200108 }
109
110 return bytes;
Jens Axboecd963e12007-06-24 21:41:46 +0200111
Jens Axboe9cce02e2007-06-22 15:42:21 +0200112}
113
114/*
115 * vmsplice() pipe to io_u buffer
116 */
117static int vmsplice_io_u_out(struct thread_data *td, struct io_u *io_u,
118 unsigned int len)
119{
120 struct netio_data *nd = td->io_ops->data;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200121
Jens Axboecd963e12007-06-24 21:41:46 +0200122 return vmsplice_io_u(io_u, nd->pipes[0], len);
Jens Axboe9cce02e2007-06-22 15:42:21 +0200123}
124
125/*
126 * vmsplice() io_u to pipe
127 */
128static int vmsplice_io_u_in(struct thread_data *td, struct io_u *io_u)
129{
130 struct netio_data *nd = td->io_ops->data;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200131
Jens Axboecd963e12007-06-24 21:41:46 +0200132 return vmsplice_io_u(io_u, nd->pipes[1], io_u->xfer_buflen);
Jens Axboe9cce02e2007-06-22 15:42:21 +0200133}
134
Jens Axboecd963e12007-06-24 21:41:46 +0200135/*
136 * splice receive - transfer socket data into a pipe using splice, then map
137 * that pipe data into the io_u using vmsplice.
138 */
Jens Axboe9cce02e2007-06-22 15:42:21 +0200139static int fio_netio_splice_in(struct thread_data *td, struct io_u *io_u)
140{
141 int ret;
142
143 ret = splice_in(td, io_u);
Jens Axboecd963e12007-06-24 21:41:46 +0200144 if (ret > 0)
145 return vmsplice_io_u_out(td, io_u, ret);
Jens Axboe9cce02e2007-06-22 15:42:21 +0200146
Jens Axboecd963e12007-06-24 21:41:46 +0200147 return ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200148}
149
Jens Axboecd963e12007-06-24 21:41:46 +0200150/*
151 * splice transmit - map data from the io_u into a pipe by using vmsplice,
152 * then transfer that pipe to a socket using splice.
153 */
Jens Axboe9cce02e2007-06-22 15:42:21 +0200154static int fio_netio_splice_out(struct thread_data *td, struct io_u *io_u)
155{
156 int ret;
157
158 ret = vmsplice_io_u_in(td, io_u);
Jens Axboecd963e12007-06-24 21:41:46 +0200159 if (ret > 0)
160 return splice_out(td, io_u, ret);
Jens Axboe9cce02e2007-06-22 15:42:21 +0200161
Jens Axboecd963e12007-06-24 21:41:46 +0200162 return ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200163}
164
165static int fio_netio_send(struct thread_data *td, struct io_u *io_u)
166{
167 int flags = 0;
168
169 /*
170 * if we are going to write more, set MSG_MORE
171 */
172 if (td->this_io_bytes[DDIR_WRITE] + io_u->xfer_buflen < td->o.size)
173 flags = MSG_MORE;
174
175 return send(io_u->file->fd, io_u->xfer_buf, io_u->xfer_buflen, flags);
176}
177
178static int fio_netio_recv(struct io_u *io_u)
179{
180 int flags = MSG_WAITALL;
181
182 return recv(io_u->file->fd, io_u->xfer_buf, io_u->xfer_buflen, flags);
183}
184
Jens Axboeed92ac02007-02-06 14:43:52 +0100185static int fio_netio_queue(struct thread_data *td, struct io_u *io_u)
186{
Jens Axboe9cce02e2007-06-22 15:42:21 +0200187 struct netio_data *nd = td->io_ops->data;
188 int ret;
Jens Axboeed92ac02007-02-06 14:43:52 +0100189
Jens Axboe7101d9c2007-09-12 13:12:39 +0200190 fio_ro_check(td, io_u);
191
Jens Axboe7a6499d2007-02-07 09:35:29 +0100192 if (io_u->ddir == DDIR_WRITE) {
Jens Axboe9cce02e2007-06-22 15:42:21 +0200193 if (nd->use_splice)
194 ret = fio_netio_splice_out(td, io_u);
195 else
196 ret = fio_netio_send(td, io_u);
Jens Axboed4f12dd2007-02-08 12:59:02 +0100197 } else if (io_u->ddir == DDIR_READ) {
Jens Axboe9cce02e2007-06-22 15:42:21 +0200198 if (nd->use_splice)
199 ret = fio_netio_splice_in(td, io_u);
200 else
201 ret = fio_netio_recv(io_u);
Jens Axboed4f12dd2007-02-08 12:59:02 +0100202 } else
Jens Axboe7a6499d2007-02-07 09:35:29 +0100203 ret = 0; /* must be a SYNC */
Jens Axboeed92ac02007-02-06 14:43:52 +0100204
Jens Axboecec6b552007-02-06 20:15:38 +0100205 if (ret != (int) io_u->xfer_buflen) {
Jens Axboe22819ec2007-02-18 07:47:14 +0100206 if (ret >= 0) {
Jens Axboecec6b552007-02-06 20:15:38 +0100207 io_u->resid = io_u->xfer_buflen - ret;
208 io_u->error = 0;
Jens Axboe36167d82007-02-18 05:41:31 +0100209 return FIO_Q_COMPLETED;
Jens Axboeed92ac02007-02-06 14:43:52 +0100210 } else
211 io_u->error = errno;
212 }
213
Jens Axboe36167d82007-02-18 05:41:31 +0100214 if (io_u->error)
Jens Axboee1161c32007-02-22 19:36:48 +0100215 td_verror(td, io_u->error, "xfer");
Jens Axboeed92ac02007-02-06 14:43:52 +0100216
Jens Axboe36167d82007-02-18 05:41:31 +0100217 return FIO_Q_COMPLETED;
Jens Axboeed92ac02007-02-06 14:43:52 +0100218}
219
Jens Axboeb5af8292007-03-08 12:43:13 +0100220static int fio_netio_connect(struct thread_data *td, struct fio_file *f)
Jens Axboeed92ac02007-02-06 14:43:52 +0100221{
Jens Axboeb5af8292007-03-08 12:43:13 +0100222 struct netio_data *nd = td->io_ops->data;
Jens Axboeed92ac02007-02-06 14:43:52 +0100223
Jens Axboeb5af8292007-03-08 12:43:13 +0100224 f->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
225 if (f->fd < 0) {
226 td_verror(td, errno, "socket");
227 return 1;
Jens Axboeed92ac02007-02-06 14:43:52 +0100228 }
229
Jens Axboeb5af8292007-03-08 12:43:13 +0100230 if (connect(f->fd, (struct sockaddr *) &nd->addr, sizeof(nd->addr)) < 0) {
231 td_verror(td, errno, "connect");
232 return 1;
Jens Axboeed92ac02007-02-06 14:43:52 +0100233 }
234
235 return 0;
Jens Axboeed92ac02007-02-06 14:43:52 +0100236}
237
Jens Axboeb5af8292007-03-08 12:43:13 +0100238static int fio_netio_accept(struct thread_data *td, struct fio_file *f)
Jens Axboe5fdd1242007-02-11 04:00:37 +0100239{
Jens Axboeb5af8292007-03-08 12:43:13 +0100240 struct netio_data *nd = td->io_ops->data;
241 socklen_t socklen = sizeof(nd->addr);
Jens Axboe5fdd1242007-02-11 04:00:37 +0100242 struct pollfd pfd;
Jens Axboeb5af8292007-03-08 12:43:13 +0100243 int ret;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100244
Jens Axboe6d861442007-03-15 09:22:23 +0100245 log_info("fio: waiting for connection\n");
Jens Axboe5fdd1242007-02-11 04:00:37 +0100246
247 /*
248 * Accept loop. poll for incoming events, accept them. Repeat until we
249 * have all connections.
250 */
Jens Axboeb5af8292007-03-08 12:43:13 +0100251 while (!td->terminate) {
252 pfd.fd = nd->listenfd;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100253 pfd.events = POLLIN;
254
255 ret = poll(&pfd, 1, -1);
Jens Axboead830ed2008-02-18 21:11:24 +0100256 printf("got ret %d\n", ret);
Jens Axboe5fdd1242007-02-11 04:00:37 +0100257 if (ret < 0) {
258 if (errno == EINTR)
259 continue;
260
Jens Axboee1161c32007-02-22 19:36:48 +0100261 td_verror(td, errno, "poll");
Jens Axboe5fdd1242007-02-11 04:00:37 +0100262 break;
263 } else if (!ret)
264 continue;
265
Jens Axboe0c094422007-02-11 04:44:02 +0100266 /*
267 * should be impossible
268 */
269 if (!(pfd.revents & POLLIN))
270 continue;
271
Jens Axboeb5af8292007-03-08 12:43:13 +0100272 f->fd = accept(nd->listenfd, (struct sockaddr *) &nd->addr, &socklen);
273 if (f->fd < 0) {
274 td_verror(td, errno, "accept");
275 return 1;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100276 }
Jens Axboeb5af8292007-03-08 12:43:13 +0100277 break;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100278 }
279
280 return 0;
281}
282
Jens Axboeb5af8292007-03-08 12:43:13 +0100283static int fio_netio_open_file(struct thread_data *td, struct fio_file *f)
Jens Axboeed92ac02007-02-06 14:43:52 +0100284{
Jens Axboeb5af8292007-03-08 12:43:13 +0100285 if (td_read(td))
286 return fio_netio_accept(td, f);
287 else
288 return fio_netio_connect(td, f);
289}
290
291static int fio_netio_setup_connect(struct thread_data *td, const char *host,
292 unsigned short port)
293{
294 struct netio_data *nd = td->io_ops->data;
295
296 nd->addr.sin_family = AF_INET;
297 nd->addr.sin_port = htons(port);
298
299 if (inet_aton(host, &nd->addr.sin_addr) != 1) {
300 struct hostent *hent;
301
302 hent = gethostbyname(host);
303 if (!hent) {
304 td_verror(td, errno, "gethostbyname");
305 return 1;
306 }
307
308 memcpy(&nd->addr.sin_addr, hent->h_addr, 4);
309 }
310
311 return 0;
312}
313
314static int fio_netio_setup_listen(struct thread_data *td, short port)
315{
316 struct netio_data *nd = td->io_ops->data;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100317 int fd, opt;
Jens Axboeed92ac02007-02-06 14:43:52 +0100318
Jens Axboe6bedbfa2007-02-07 09:54:40 +0100319 fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
Jens Axboeed92ac02007-02-06 14:43:52 +0100320 if (fd < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100321 td_verror(td, errno, "socket");
Jens Axboeed92ac02007-02-06 14:43:52 +0100322 return 1;
323 }
324
325 opt = 1;
326 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100327 td_verror(td, errno, "setsockopt");
Jens Axboeed92ac02007-02-06 14:43:52 +0100328 return 1;
329 }
Jens Axboe6bedbfa2007-02-07 09:54:40 +0100330#ifdef SO_REUSEPORT
331 if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100332 td_verror(td, errno, "setsockopt");
Jens Axboe6bedbfa2007-02-07 09:54:40 +0100333 return 1;
334 }
335#endif
Jens Axboeed92ac02007-02-06 14:43:52 +0100336
Jens Axboeb5af8292007-03-08 12:43:13 +0100337 nd->addr.sin_family = AF_INET;
338 nd->addr.sin_addr.s_addr = htonl(INADDR_ANY);
339 nd->addr.sin_port = htons(port);
Jens Axboeed92ac02007-02-06 14:43:52 +0100340
Jens Axboeb5af8292007-03-08 12:43:13 +0100341 if (bind(fd, (struct sockaddr *) &nd->addr, sizeof(nd->addr)) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100342 td_verror(td, errno, "bind");
Jens Axboeed92ac02007-02-06 14:43:52 +0100343 return 1;
344 }
345 if (listen(fd, 1) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100346 td_verror(td, errno, "listen");
Jens Axboeed92ac02007-02-06 14:43:52 +0100347 return 1;
348 }
349
Jens Axboeb5af8292007-03-08 12:43:13 +0100350 nd->listenfd = fd;
351 return 0;
Jens Axboeed92ac02007-02-06 14:43:52 +0100352}
353
Jens Axboe9bec88e2007-03-02 08:55:48 +0100354static int fio_netio_init(struct thread_data *td)
Jens Axboeed92ac02007-02-06 14:43:52 +0100355{
Jens Axboeb5af8292007-03-08 12:43:13 +0100356 struct netio_data *nd = td->io_ops->data;
Jens Axboee01547d2007-02-06 19:16:01 +0100357 unsigned short port;
Jens Axboeb5af8292007-03-08 12:43:13 +0100358 char host[64], buf[128];
Jens Axboeed92ac02007-02-06 14:43:52 +0100359 char *sep;
Jens Axboeaf52b342007-03-13 10:07:47 +0100360 int ret;
Jens Axboeed92ac02007-02-06 14:43:52 +0100361
Jens Axboe413dd452007-02-23 09:26:09 +0100362 if (td_rw(td)) {
Jens Axboeed92ac02007-02-06 14:43:52 +0100363 log_err("fio: network connections must be read OR write\n");
364 return 1;
365 }
Jens Axboe16d55aa2007-05-22 09:21:37 +0200366 if (td_random(td)) {
367 log_err("fio: network IO can't be random\n");
368 return 1;
369 }
Jens Axboeed92ac02007-02-06 14:43:52 +0100370
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100371 strcpy(buf, td->o.filename);
Jens Axboeed92ac02007-02-06 14:43:52 +0100372
Jens Axboe9f9214f2007-03-13 14:02:16 +0100373 sep = strchr(buf, '/');
Jens Axboeed92ac02007-02-06 14:43:52 +0100374 if (!sep) {
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100375 log_err("fio: bad network host/port <<%s>>\n", td->o.filename);
Jens Axboeed92ac02007-02-06 14:43:52 +0100376 return 1;
377 }
378
379 *sep = '\0';
380 sep++;
381 strcpy(host, buf);
Jens Axboee01547d2007-02-06 19:16:01 +0100382 port = atoi(sep);
Jens Axboeed92ac02007-02-06 14:43:52 +0100383
Jens Axboe413dd452007-02-23 09:26:09 +0100384 if (td_read(td)) {
Jens Axboeb5af8292007-03-08 12:43:13 +0100385 nd->send_to_net = 0;
Jens Axboeed92ac02007-02-06 14:43:52 +0100386 ret = fio_netio_setup_listen(td, port);
387 } else {
Jens Axboeb5af8292007-03-08 12:43:13 +0100388 nd->send_to_net = 1;
Jens Axboeed92ac02007-02-06 14:43:52 +0100389 ret = fio_netio_setup_connect(td, host, port);
390 }
391
Jens Axboe7bb48f82007-03-27 15:30:28 +0200392 return ret;
Jens Axboeed92ac02007-02-06 14:43:52 +0100393}
394
Jens Axboeb5af8292007-03-08 12:43:13 +0100395static void fio_netio_cleanup(struct thread_data *td)
Jens Axboe9bec88e2007-03-02 08:55:48 +0100396{
Jens Axboeb5af8292007-03-08 12:43:13 +0100397 struct netio_data *nd = td->io_ops->data;
398
399 if (nd) {
Jens Axboe64b24cd2007-06-24 21:28:39 +0200400 if (nd->listenfd != -1)
401 close(nd->listenfd);
402 if (nd->pipes[0] != -1)
403 close(nd->pipes[0]);
404 if (nd->pipes[1] != -1)
405 close(nd->pipes[1]);
406
Jens Axboeb5af8292007-03-08 12:43:13 +0100407 free(nd);
408 td->io_ops->data = NULL;
409 }
410}
411
412static int fio_netio_setup(struct thread_data *td)
413{
Jens Axboe7bb48f82007-03-27 15:30:28 +0200414 struct netio_data *nd;
Jens Axboeb5af8292007-03-08 12:43:13 +0100415
Jens Axboe7bb48f82007-03-27 15:30:28 +0200416 if (!td->io_ops->data) {
417 nd = malloc(sizeof(*nd));;
418
419 memset(nd, 0, sizeof(*nd));
420 nd->listenfd = -1;
Jens Axboe64b24cd2007-06-24 21:28:39 +0200421 nd->pipes[0] = nd->pipes[1] = -1;
Jens Axboe7bb48f82007-03-27 15:30:28 +0200422 td->io_ops->data = nd;
Jens Axboe7bb48f82007-03-27 15:30:28 +0200423 }
424
Jens Axboe9bec88e2007-03-02 08:55:48 +0100425 return 0;
426}
427
Jens Axboe9cce02e2007-06-22 15:42:21 +0200428static int fio_netio_setup_splice(struct thread_data *td)
429{
430 struct netio_data *nd;
431
432 fio_netio_setup(td);
433
434 nd = td->io_ops->data;
435 if (nd) {
436 if (pipe(nd->pipes) < 0)
437 return 1;
438
439 nd->use_splice = 1;
440 return 0;
441 }
442
443 return 1;
444}
445
446static struct ioengine_ops ioengine_rw = {
Jens Axboeed92ac02007-02-06 14:43:52 +0100447 .name = "net",
448 .version = FIO_IOOPS_VERSION,
Jens Axboeed92ac02007-02-06 14:43:52 +0100449 .prep = fio_netio_prep,
450 .queue = fio_netio_queue,
Jens Axboeed92ac02007-02-06 14:43:52 +0100451 .setup = fio_netio_setup,
Jens Axboe9bec88e2007-03-02 08:55:48 +0100452 .init = fio_netio_init,
Jens Axboeb5af8292007-03-08 12:43:13 +0100453 .cleanup = fio_netio_cleanup,
454 .open_file = fio_netio_open_file,
455 .close_file = generic_close_file,
Jens Axboead830ed2008-02-18 21:11:24 +0100456 .flags = FIO_SYNCIO | FIO_DISKLESSIO | FIO_UNIDIR |
457 FIO_SIGQUIT,
Jens Axboeed92ac02007-02-06 14:43:52 +0100458};
459
Jens Axboe9cce02e2007-06-22 15:42:21 +0200460static struct ioengine_ops ioengine_splice = {
461 .name = "netsplice",
462 .version = FIO_IOOPS_VERSION,
463 .prep = fio_netio_prep,
464 .queue = fio_netio_queue,
465 .setup = fio_netio_setup_splice,
466 .init = fio_netio_init,
467 .cleanup = fio_netio_cleanup,
468 .open_file = fio_netio_open_file,
469 .close_file = generic_close_file,
Jens Axboead830ed2008-02-18 21:11:24 +0100470 .flags = FIO_SYNCIO | FIO_DISKLESSIO | FIO_UNIDIR |
471 FIO_SIGQUIT,
Jens Axboe9cce02e2007-06-22 15:42:21 +0200472};
473
Jens Axboeed92ac02007-02-06 14:43:52 +0100474static void fio_init fio_netio_register(void)
475{
Jens Axboe9cce02e2007-06-22 15:42:21 +0200476 register_ioengine(&ioengine_rw);
477 register_ioengine(&ioengine_splice);
Jens Axboeed92ac02007-02-06 14:43:52 +0100478}
479
480static void fio_exit fio_netio_unregister(void)
481{
Jens Axboe9cce02e2007-06-22 15:42:21 +0200482 unregister_ioengine(&ioengine_rw);
483 unregister_ioengine(&ioengine_splice);
Jens Axboeed92ac02007-02-06 14:43:52 +0100484}