blob: 137c5799169fa10fbdbaeb597c87f0c7c17f0b95 [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);
256 if (ret < 0) {
257 if (errno == EINTR)
258 continue;
259
Jens Axboee1161c32007-02-22 19:36:48 +0100260 td_verror(td, errno, "poll");
Jens Axboe5fdd1242007-02-11 04:00:37 +0100261 break;
262 } else if (!ret)
263 continue;
264
Jens Axboe0c094422007-02-11 04:44:02 +0100265 /*
266 * should be impossible
267 */
268 if (!(pfd.revents & POLLIN))
269 continue;
270
Jens Axboeb5af8292007-03-08 12:43:13 +0100271 f->fd = accept(nd->listenfd, (struct sockaddr *) &nd->addr, &socklen);
272 if (f->fd < 0) {
273 td_verror(td, errno, "accept");
274 return 1;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100275 }
Jens Axboeb5af8292007-03-08 12:43:13 +0100276 break;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100277 }
278
279 return 0;
280}
281
Jens Axboeb5af8292007-03-08 12:43:13 +0100282static int fio_netio_open_file(struct thread_data *td, struct fio_file *f)
Jens Axboeed92ac02007-02-06 14:43:52 +0100283{
Jens Axboeb5af8292007-03-08 12:43:13 +0100284 if (td_read(td))
285 return fio_netio_accept(td, f);
286 else
287 return fio_netio_connect(td, f);
288}
289
290static int fio_netio_setup_connect(struct thread_data *td, const char *host,
291 unsigned short port)
292{
293 struct netio_data *nd = td->io_ops->data;
294
295 nd->addr.sin_family = AF_INET;
296 nd->addr.sin_port = htons(port);
297
298 if (inet_aton(host, &nd->addr.sin_addr) != 1) {
299 struct hostent *hent;
300
301 hent = gethostbyname(host);
302 if (!hent) {
303 td_verror(td, errno, "gethostbyname");
304 return 1;
305 }
306
307 memcpy(&nd->addr.sin_addr, hent->h_addr, 4);
308 }
309
310 return 0;
311}
312
313static int fio_netio_setup_listen(struct thread_data *td, short port)
314{
315 struct netio_data *nd = td->io_ops->data;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100316 int fd, opt;
Jens Axboeed92ac02007-02-06 14:43:52 +0100317
Jens Axboe6bedbfa2007-02-07 09:54:40 +0100318 fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
Jens Axboeed92ac02007-02-06 14:43:52 +0100319 if (fd < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100320 td_verror(td, errno, "socket");
Jens Axboeed92ac02007-02-06 14:43:52 +0100321 return 1;
322 }
323
324 opt = 1;
325 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100326 td_verror(td, errno, "setsockopt");
Jens Axboeed92ac02007-02-06 14:43:52 +0100327 return 1;
328 }
Jens Axboe6bedbfa2007-02-07 09:54:40 +0100329#ifdef SO_REUSEPORT
330 if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100331 td_verror(td, errno, "setsockopt");
Jens Axboe6bedbfa2007-02-07 09:54:40 +0100332 return 1;
333 }
334#endif
Jens Axboeed92ac02007-02-06 14:43:52 +0100335
Jens Axboeb5af8292007-03-08 12:43:13 +0100336 nd->addr.sin_family = AF_INET;
337 nd->addr.sin_addr.s_addr = htonl(INADDR_ANY);
338 nd->addr.sin_port = htons(port);
Jens Axboeed92ac02007-02-06 14:43:52 +0100339
Jens Axboeb5af8292007-03-08 12:43:13 +0100340 if (bind(fd, (struct sockaddr *) &nd->addr, sizeof(nd->addr)) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100341 td_verror(td, errno, "bind");
Jens Axboeed92ac02007-02-06 14:43:52 +0100342 return 1;
343 }
344 if (listen(fd, 1) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100345 td_verror(td, errno, "listen");
Jens Axboeed92ac02007-02-06 14:43:52 +0100346 return 1;
347 }
348
Jens Axboeb5af8292007-03-08 12:43:13 +0100349 nd->listenfd = fd;
350 return 0;
Jens Axboeed92ac02007-02-06 14:43:52 +0100351}
352
Jens Axboe9bec88e2007-03-02 08:55:48 +0100353static int fio_netio_init(struct thread_data *td)
Jens Axboeed92ac02007-02-06 14:43:52 +0100354{
Jens Axboeb5af8292007-03-08 12:43:13 +0100355 struct netio_data *nd = td->io_ops->data;
Jens Axboe443662e2008-05-30 13:29:03 +0200356 unsigned int port;
Jens Axboeb5af8292007-03-08 12:43:13 +0100357 char host[64], buf[128];
Jens Axboeed92ac02007-02-06 14:43:52 +0100358 char *sep;
Jens Axboeaf52b342007-03-13 10:07:47 +0100359 int ret;
Jens Axboeed92ac02007-02-06 14:43:52 +0100360
Jens Axboe413dd452007-02-23 09:26:09 +0100361 if (td_rw(td)) {
Jens Axboeed92ac02007-02-06 14:43:52 +0100362 log_err("fio: network connections must be read OR write\n");
363 return 1;
364 }
Jens Axboe16d55aa2007-05-22 09:21:37 +0200365 if (td_random(td)) {
366 log_err("fio: network IO can't be random\n");
367 return 1;
368 }
Jens Axboeed92ac02007-02-06 14:43:52 +0100369
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100370 strcpy(buf, td->o.filename);
Jens Axboeed92ac02007-02-06 14:43:52 +0100371
Jens Axboe9f9214f2007-03-13 14:02:16 +0100372 sep = strchr(buf, '/');
Jens Axboe443662e2008-05-30 13:29:03 +0200373 if (!sep)
374 goto bad_host;
Jens Axboeed92ac02007-02-06 14:43:52 +0100375
376 *sep = '\0';
377 sep++;
378 strcpy(host, buf);
Jens Axboe443662e2008-05-30 13:29:03 +0200379 if (!strlen(host))
380 goto bad_host;
381
382 port = strtol(sep, NULL, 10);
383 if (!port || port > 65535)
384 goto bad_host;
Jens Axboeed92ac02007-02-06 14:43:52 +0100385
Jens Axboe413dd452007-02-23 09:26:09 +0100386 if (td_read(td)) {
Jens Axboeb5af8292007-03-08 12:43:13 +0100387 nd->send_to_net = 0;
Jens Axboeed92ac02007-02-06 14:43:52 +0100388 ret = fio_netio_setup_listen(td, port);
389 } else {
Jens Axboeb5af8292007-03-08 12:43:13 +0100390 nd->send_to_net = 1;
Jens Axboeed92ac02007-02-06 14:43:52 +0100391 ret = fio_netio_setup_connect(td, host, port);
392 }
393
Jens Axboe7bb48f82007-03-27 15:30:28 +0200394 return ret;
Jens Axboe443662e2008-05-30 13:29:03 +0200395bad_host:
396 log_err("fio: bad network host/port: %s\n", td->o.filename);
397 return 1;
Jens Axboeed92ac02007-02-06 14:43:52 +0100398}
399
Jens Axboeb5af8292007-03-08 12:43:13 +0100400static void fio_netio_cleanup(struct thread_data *td)
Jens Axboe9bec88e2007-03-02 08:55:48 +0100401{
Jens Axboeb5af8292007-03-08 12:43:13 +0100402 struct netio_data *nd = td->io_ops->data;
403
404 if (nd) {
Jens Axboe64b24cd2007-06-24 21:28:39 +0200405 if (nd->listenfd != -1)
406 close(nd->listenfd);
407 if (nd->pipes[0] != -1)
408 close(nd->pipes[0]);
409 if (nd->pipes[1] != -1)
410 close(nd->pipes[1]);
411
Jens Axboeb5af8292007-03-08 12:43:13 +0100412 free(nd);
413 td->io_ops->data = NULL;
414 }
415}
416
417static int fio_netio_setup(struct thread_data *td)
418{
Jens Axboe7bb48f82007-03-27 15:30:28 +0200419 struct netio_data *nd;
Jens Axboeb5af8292007-03-08 12:43:13 +0100420
Jens Axboe7bb48f82007-03-27 15:30:28 +0200421 if (!td->io_ops->data) {
422 nd = malloc(sizeof(*nd));;
423
424 memset(nd, 0, sizeof(*nd));
425 nd->listenfd = -1;
Jens Axboe64b24cd2007-06-24 21:28:39 +0200426 nd->pipes[0] = nd->pipes[1] = -1;
Jens Axboe7bb48f82007-03-27 15:30:28 +0200427 td->io_ops->data = nd;
Jens Axboe7bb48f82007-03-27 15:30:28 +0200428 }
429
Jens Axboe9bec88e2007-03-02 08:55:48 +0100430 return 0;
431}
432
Jens Axboe9cce02e2007-06-22 15:42:21 +0200433static int fio_netio_setup_splice(struct thread_data *td)
434{
435 struct netio_data *nd;
436
437 fio_netio_setup(td);
438
439 nd = td->io_ops->data;
440 if (nd) {
441 if (pipe(nd->pipes) < 0)
442 return 1;
443
444 nd->use_splice = 1;
445 return 0;
446 }
447
448 return 1;
449}
450
451static struct ioengine_ops ioengine_rw = {
Jens Axboeed92ac02007-02-06 14:43:52 +0100452 .name = "net",
453 .version = FIO_IOOPS_VERSION,
Jens Axboeed92ac02007-02-06 14:43:52 +0100454 .prep = fio_netio_prep,
455 .queue = fio_netio_queue,
Jens Axboeed92ac02007-02-06 14:43:52 +0100456 .setup = fio_netio_setup,
Jens Axboe9bec88e2007-03-02 08:55:48 +0100457 .init = fio_netio_init,
Jens Axboeb5af8292007-03-08 12:43:13 +0100458 .cleanup = fio_netio_cleanup,
459 .open_file = fio_netio_open_file,
460 .close_file = generic_close_file,
Jens Axboead830ed2008-02-18 21:11:24 +0100461 .flags = FIO_SYNCIO | FIO_DISKLESSIO | FIO_UNIDIR |
462 FIO_SIGQUIT,
Jens Axboeed92ac02007-02-06 14:43:52 +0100463};
464
Jens Axboe9cce02e2007-06-22 15:42:21 +0200465static struct ioengine_ops ioengine_splice = {
466 .name = "netsplice",
467 .version = FIO_IOOPS_VERSION,
468 .prep = fio_netio_prep,
469 .queue = fio_netio_queue,
470 .setup = fio_netio_setup_splice,
471 .init = fio_netio_init,
472 .cleanup = fio_netio_cleanup,
473 .open_file = fio_netio_open_file,
474 .close_file = generic_close_file,
Jens Axboead830ed2008-02-18 21:11:24 +0100475 .flags = FIO_SYNCIO | FIO_DISKLESSIO | FIO_UNIDIR |
476 FIO_SIGQUIT,
Jens Axboe9cce02e2007-06-22 15:42:21 +0200477};
478
Jens Axboeed92ac02007-02-06 14:43:52 +0100479static void fio_init fio_netio_register(void)
480{
Jens Axboe9cce02e2007-06-22 15:42:21 +0200481 register_ioengine(&ioengine_rw);
482 register_ioengine(&ioengine_splice);
Jens Axboeed92ac02007-02-06 14:43:52 +0100483}
484
485static void fio_exit fio_netio_unregister(void)
486{
Jens Axboe9cce02e2007-06-22 15:42:21 +0200487 unregister_ioengine(&ioengine_rw);
488 unregister_ioengine(&ioengine_splice);
Jens Axboeed92ac02007-02-06 14:43:52 +0100489}