blob: 52e3b049690dac057147122de59358de81b0fb0b [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 struct fio_file *f = io_u->file;
32
Jens Axboe7a6499d2007-02-07 09:35:29 +010033 /*
34 * Make sure we don't see spurious reads to a receiver, and vice versa
35 */
Jens Axboeb5af8292007-03-08 12:43:13 +010036 if ((nd->send_to_net && io_u->ddir == DDIR_READ) ||
37 (!nd->send_to_net && io_u->ddir == DDIR_WRITE)) {
Jens Axboee1161c32007-02-22 19:36:48 +010038 td_verror(td, EINVAL, "bad direction");
Jens Axboe7a6499d2007-02-07 09:35:29 +010039 return 1;
Jens Axboeed92ac02007-02-06 14:43:52 +010040 }
Jens Axboe7a6499d2007-02-07 09:35:29 +010041
Jens Axboeed92ac02007-02-06 14:43:52 +010042 if (io_u->ddir == DDIR_SYNC)
43 return 0;
44 if (io_u->offset == f->last_completed_pos)
45 return 0;
46
Jens Axboee01547d2007-02-06 19:16:01 +010047 /*
48 * If offset is different from last end position, it's a seek.
49 * As network io is purely sequential, we don't allow seeks.
50 */
Jens Axboee1161c32007-02-22 19:36:48 +010051 td_verror(td, EINVAL, "cannot seek");
Jens Axboeed92ac02007-02-06 14:43:52 +010052 return 1;
53}
54
Jens Axboecd963e12007-06-24 21:41:46 +020055static int splice_io_u(int fdin, int fdout, unsigned int len)
Jens Axboe9cce02e2007-06-22 15:42:21 +020056{
Jens Axboe9cce02e2007-06-22 15:42:21 +020057 int bytes = 0;
58
59 while (len) {
Jens Axboecd963e12007-06-24 21:41:46 +020060 int ret = splice(fdin, NULL, fdout, NULL, len, 0);
Jens Axboe9cce02e2007-06-22 15:42:21 +020061
62 if (ret < 0) {
63 if (!bytes)
64 bytes = ret;
65
66 break;
67 } else if (!ret)
68 break;
69
70 bytes += ret;
Jens Axboef657a2f2007-06-22 20:40:10 +020071 len -= ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +020072 }
73
74 return bytes;
75}
76
77/*
Jens Axboecd963e12007-06-24 21:41:46 +020078 * Receive bytes from a socket and fill them into the internal pipe
79 */
80static int splice_in(struct thread_data *td, struct io_u *io_u)
81{
82 struct netio_data *nd = td->io_ops->data;
83
84 return splice_io_u(io_u->file->fd, nd->pipes[1], io_u->xfer_buflen);
85}
86
87/*
Jens Axboe9cce02e2007-06-22 15:42:21 +020088 * Transmit 'len' bytes from the internal pipe
89 */
90static int splice_out(struct thread_data *td, struct io_u *io_u,
91 unsigned int len)
92{
93 struct netio_data *nd = td->io_ops->data;
Jens Axboecd963e12007-06-24 21:41:46 +020094
95 return splice_io_u(nd->pipes[0], io_u->file->fd, len);
96}
97
98static int vmsplice_io_u(struct io_u *io_u, int fd, unsigned int len)
99{
100 struct iovec iov = {
101 .iov_base = io_u->xfer_buf,
102 .iov_len = len,
103 };
Jens Axboe9cce02e2007-06-22 15:42:21 +0200104 int bytes = 0;
105
Jens Axboecd963e12007-06-24 21:41:46 +0200106 while (iov.iov_len) {
107 int ret = vmsplice(fd, &iov, 1, SPLICE_F_MOVE);
Jens Axboe9cce02e2007-06-22 15:42:21 +0200108
109 if (ret < 0) {
110 if (!bytes)
111 bytes = ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200112 break;
113 } else if (!ret)
114 break;
115
Jens Axboecd963e12007-06-24 21:41:46 +0200116 iov.iov_len -= ret;
117 iov.iov_base += ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200118 bytes += ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200119 }
120
121 return bytes;
Jens Axboecd963e12007-06-24 21:41:46 +0200122
Jens Axboe9cce02e2007-06-22 15:42:21 +0200123}
124
125/*
126 * vmsplice() pipe to io_u buffer
127 */
128static int vmsplice_io_u_out(struct thread_data *td, struct io_u *io_u,
129 unsigned int len)
130{
131 struct netio_data *nd = td->io_ops->data;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200132
Jens Axboecd963e12007-06-24 21:41:46 +0200133 return vmsplice_io_u(io_u, nd->pipes[0], len);
Jens Axboe9cce02e2007-06-22 15:42:21 +0200134}
135
136/*
137 * vmsplice() io_u to pipe
138 */
139static int vmsplice_io_u_in(struct thread_data *td, struct io_u *io_u)
140{
141 struct netio_data *nd = td->io_ops->data;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200142
Jens Axboecd963e12007-06-24 21:41:46 +0200143 return vmsplice_io_u(io_u, nd->pipes[1], io_u->xfer_buflen);
Jens Axboe9cce02e2007-06-22 15:42:21 +0200144}
145
Jens Axboecd963e12007-06-24 21:41:46 +0200146/*
147 * splice receive - transfer socket data into a pipe using splice, then map
148 * that pipe data into the io_u using vmsplice.
149 */
Jens Axboe9cce02e2007-06-22 15:42:21 +0200150static int fio_netio_splice_in(struct thread_data *td, struct io_u *io_u)
151{
152 int ret;
153
154 ret = splice_in(td, io_u);
Jens Axboecd963e12007-06-24 21:41:46 +0200155 if (ret > 0)
156 return vmsplice_io_u_out(td, io_u, ret);
Jens Axboe9cce02e2007-06-22 15:42:21 +0200157
Jens Axboecd963e12007-06-24 21:41:46 +0200158 return ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200159}
160
Jens Axboecd963e12007-06-24 21:41:46 +0200161/*
162 * splice transmit - map data from the io_u into a pipe by using vmsplice,
163 * then transfer that pipe to a socket using splice.
164 */
Jens Axboe9cce02e2007-06-22 15:42:21 +0200165static int fio_netio_splice_out(struct thread_data *td, struct io_u *io_u)
166{
167 int ret;
168
169 ret = vmsplice_io_u_in(td, io_u);
Jens Axboecd963e12007-06-24 21:41:46 +0200170 if (ret > 0)
171 return splice_out(td, io_u, ret);
Jens Axboe9cce02e2007-06-22 15:42:21 +0200172
Jens Axboecd963e12007-06-24 21:41:46 +0200173 return ret;
Jens Axboe9cce02e2007-06-22 15:42:21 +0200174}
175
176static int fio_netio_send(struct thread_data *td, struct io_u *io_u)
177{
178 int flags = 0;
179
180 /*
181 * if we are going to write more, set MSG_MORE
182 */
183 if (td->this_io_bytes[DDIR_WRITE] + io_u->xfer_buflen < td->o.size)
184 flags = MSG_MORE;
185
186 return send(io_u->file->fd, io_u->xfer_buf, io_u->xfer_buflen, flags);
187}
188
189static int fio_netio_recv(struct io_u *io_u)
190{
191 int flags = MSG_WAITALL;
192
193 return recv(io_u->file->fd, io_u->xfer_buf, io_u->xfer_buflen, flags);
194}
195
Jens Axboeed92ac02007-02-06 14:43:52 +0100196static int fio_netio_queue(struct thread_data *td, struct io_u *io_u)
197{
Jens Axboe9cce02e2007-06-22 15:42:21 +0200198 struct netio_data *nd = td->io_ops->data;
199 int ret;
Jens Axboeed92ac02007-02-06 14:43:52 +0100200
Jens Axboe7a6499d2007-02-07 09:35:29 +0100201 if (io_u->ddir == DDIR_WRITE) {
Jens Axboe9cce02e2007-06-22 15:42:21 +0200202 if (nd->use_splice)
203 ret = fio_netio_splice_out(td, io_u);
204 else
205 ret = fio_netio_send(td, io_u);
Jens Axboed4f12dd2007-02-08 12:59:02 +0100206 } else if (io_u->ddir == DDIR_READ) {
Jens Axboe9cce02e2007-06-22 15:42:21 +0200207 if (nd->use_splice)
208 ret = fio_netio_splice_in(td, io_u);
209 else
210 ret = fio_netio_recv(io_u);
Jens Axboed4f12dd2007-02-08 12:59:02 +0100211 } else
Jens Axboe7a6499d2007-02-07 09:35:29 +0100212 ret = 0; /* must be a SYNC */
Jens Axboeed92ac02007-02-06 14:43:52 +0100213
Jens Axboecec6b552007-02-06 20:15:38 +0100214 if (ret != (int) io_u->xfer_buflen) {
Jens Axboe22819ec2007-02-18 07:47:14 +0100215 if (ret >= 0) {
Jens Axboecec6b552007-02-06 20:15:38 +0100216 io_u->resid = io_u->xfer_buflen - ret;
217 io_u->error = 0;
Jens Axboe36167d82007-02-18 05:41:31 +0100218 return FIO_Q_COMPLETED;
Jens Axboeed92ac02007-02-06 14:43:52 +0100219 } else
220 io_u->error = errno;
221 }
222
Jens Axboe36167d82007-02-18 05:41:31 +0100223 if (io_u->error)
Jens Axboee1161c32007-02-22 19:36:48 +0100224 td_verror(td, io_u->error, "xfer");
Jens Axboeed92ac02007-02-06 14:43:52 +0100225
Jens Axboe36167d82007-02-18 05:41:31 +0100226 return FIO_Q_COMPLETED;
Jens Axboeed92ac02007-02-06 14:43:52 +0100227}
228
Jens Axboeb5af8292007-03-08 12:43:13 +0100229static int fio_netio_connect(struct thread_data *td, struct fio_file *f)
Jens Axboeed92ac02007-02-06 14:43:52 +0100230{
Jens Axboeb5af8292007-03-08 12:43:13 +0100231 struct netio_data *nd = td->io_ops->data;
Jens Axboeed92ac02007-02-06 14:43:52 +0100232
Jens Axboeb5af8292007-03-08 12:43:13 +0100233 f->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
234 if (f->fd < 0) {
235 td_verror(td, errno, "socket");
236 return 1;
Jens Axboeed92ac02007-02-06 14:43:52 +0100237 }
238
Jens Axboeb5af8292007-03-08 12:43:13 +0100239 if (connect(f->fd, (struct sockaddr *) &nd->addr, sizeof(nd->addr)) < 0) {
240 td_verror(td, errno, "connect");
241 return 1;
Jens Axboeed92ac02007-02-06 14:43:52 +0100242 }
243
244 return 0;
Jens Axboeed92ac02007-02-06 14:43:52 +0100245}
246
Jens Axboeb5af8292007-03-08 12:43:13 +0100247static int fio_netio_accept(struct thread_data *td, struct fio_file *f)
Jens Axboe5fdd1242007-02-11 04:00:37 +0100248{
Jens Axboeb5af8292007-03-08 12:43:13 +0100249 struct netio_data *nd = td->io_ops->data;
250 socklen_t socklen = sizeof(nd->addr);
Jens Axboe5fdd1242007-02-11 04:00:37 +0100251 struct pollfd pfd;
Jens Axboeb5af8292007-03-08 12:43:13 +0100252 int ret;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100253
Jens Axboe6d861442007-03-15 09:22:23 +0100254 log_info("fio: waiting for connection\n");
Jens Axboe5fdd1242007-02-11 04:00:37 +0100255
256 /*
257 * Accept loop. poll for incoming events, accept them. Repeat until we
258 * have all connections.
259 */
Jens Axboeb5af8292007-03-08 12:43:13 +0100260 while (!td->terminate) {
261 pfd.fd = nd->listenfd;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100262 pfd.events = POLLIN;
263
264 ret = poll(&pfd, 1, -1);
265 if (ret < 0) {
266 if (errno == EINTR)
267 continue;
268
Jens Axboee1161c32007-02-22 19:36:48 +0100269 td_verror(td, errno, "poll");
Jens Axboe5fdd1242007-02-11 04:00:37 +0100270 break;
271 } else if (!ret)
272 continue;
273
Jens Axboe0c094422007-02-11 04:44:02 +0100274 /*
275 * should be impossible
276 */
277 if (!(pfd.revents & POLLIN))
278 continue;
279
Jens Axboeb5af8292007-03-08 12:43:13 +0100280 f->fd = accept(nd->listenfd, (struct sockaddr *) &nd->addr, &socklen);
281 if (f->fd < 0) {
282 td_verror(td, errno, "accept");
283 return 1;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100284 }
Jens Axboeb5af8292007-03-08 12:43:13 +0100285 break;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100286 }
287
288 return 0;
289}
290
Jens Axboeb5af8292007-03-08 12:43:13 +0100291static int fio_netio_open_file(struct thread_data *td, struct fio_file *f)
Jens Axboeed92ac02007-02-06 14:43:52 +0100292{
Jens Axboeb5af8292007-03-08 12:43:13 +0100293 if (td_read(td))
294 return fio_netio_accept(td, f);
295 else
296 return fio_netio_connect(td, f);
297}
298
299static int fio_netio_setup_connect(struct thread_data *td, const char *host,
300 unsigned short port)
301{
302 struct netio_data *nd = td->io_ops->data;
303
304 nd->addr.sin_family = AF_INET;
305 nd->addr.sin_port = htons(port);
306
307 if (inet_aton(host, &nd->addr.sin_addr) != 1) {
308 struct hostent *hent;
309
310 hent = gethostbyname(host);
311 if (!hent) {
312 td_verror(td, errno, "gethostbyname");
313 return 1;
314 }
315
316 memcpy(&nd->addr.sin_addr, hent->h_addr, 4);
317 }
318
319 return 0;
320}
321
322static int fio_netio_setup_listen(struct thread_data *td, short port)
323{
324 struct netio_data *nd = td->io_ops->data;
Jens Axboe5fdd1242007-02-11 04:00:37 +0100325 int fd, opt;
Jens Axboeed92ac02007-02-06 14:43:52 +0100326
Jens Axboe6bedbfa2007-02-07 09:54:40 +0100327 fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
Jens Axboeed92ac02007-02-06 14:43:52 +0100328 if (fd < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100329 td_verror(td, errno, "socket");
Jens Axboeed92ac02007-02-06 14:43:52 +0100330 return 1;
331 }
332
333 opt = 1;
334 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100335 td_verror(td, errno, "setsockopt");
Jens Axboeed92ac02007-02-06 14:43:52 +0100336 return 1;
337 }
Jens Axboe6bedbfa2007-02-07 09:54:40 +0100338#ifdef SO_REUSEPORT
339 if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100340 td_verror(td, errno, "setsockopt");
Jens Axboe6bedbfa2007-02-07 09:54:40 +0100341 return 1;
342 }
343#endif
Jens Axboeed92ac02007-02-06 14:43:52 +0100344
Jens Axboeb5af8292007-03-08 12:43:13 +0100345 nd->addr.sin_family = AF_INET;
346 nd->addr.sin_addr.s_addr = htonl(INADDR_ANY);
347 nd->addr.sin_port = htons(port);
Jens Axboeed92ac02007-02-06 14:43:52 +0100348
Jens Axboeb5af8292007-03-08 12:43:13 +0100349 if (bind(fd, (struct sockaddr *) &nd->addr, sizeof(nd->addr)) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100350 td_verror(td, errno, "bind");
Jens Axboeed92ac02007-02-06 14:43:52 +0100351 return 1;
352 }
353 if (listen(fd, 1) < 0) {
Jens Axboee1161c32007-02-22 19:36:48 +0100354 td_verror(td, errno, "listen");
Jens Axboeed92ac02007-02-06 14:43:52 +0100355 return 1;
356 }
357
Jens Axboeb5af8292007-03-08 12:43:13 +0100358 nd->listenfd = fd;
359 return 0;
Jens Axboeed92ac02007-02-06 14:43:52 +0100360}
361
Jens Axboe9bec88e2007-03-02 08:55:48 +0100362static int fio_netio_init(struct thread_data *td)
Jens Axboeed92ac02007-02-06 14:43:52 +0100363{
Jens Axboeb5af8292007-03-08 12:43:13 +0100364 struct netio_data *nd = td->io_ops->data;
Jens Axboee01547d2007-02-06 19:16:01 +0100365 unsigned short port;
Jens Axboeb5af8292007-03-08 12:43:13 +0100366 char host[64], buf[128];
Jens Axboeed92ac02007-02-06 14:43:52 +0100367 char *sep;
Jens Axboeaf52b342007-03-13 10:07:47 +0100368 int ret;
Jens Axboeed92ac02007-02-06 14:43:52 +0100369
Jens Axboe413dd452007-02-23 09:26:09 +0100370 if (td_rw(td)) {
Jens Axboeed92ac02007-02-06 14:43:52 +0100371 log_err("fio: network connections must be read OR write\n");
372 return 1;
373 }
Jens Axboe16d55aa2007-05-22 09:21:37 +0200374 if (td_random(td)) {
375 log_err("fio: network IO can't be random\n");
376 return 1;
377 }
Jens Axboeed92ac02007-02-06 14:43:52 +0100378
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100379 strcpy(buf, td->o.filename);
Jens Axboeed92ac02007-02-06 14:43:52 +0100380
Jens Axboe9f9214f2007-03-13 14:02:16 +0100381 sep = strchr(buf, '/');
Jens Axboeed92ac02007-02-06 14:43:52 +0100382 if (!sep) {
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100383 log_err("fio: bad network host/port <<%s>>\n", td->o.filename);
Jens Axboeed92ac02007-02-06 14:43:52 +0100384 return 1;
385 }
386
387 *sep = '\0';
388 sep++;
389 strcpy(host, buf);
Jens Axboee01547d2007-02-06 19:16:01 +0100390 port = atoi(sep);
Jens Axboeed92ac02007-02-06 14:43:52 +0100391
Jens Axboe413dd452007-02-23 09:26:09 +0100392 if (td_read(td)) {
Jens Axboeb5af8292007-03-08 12:43:13 +0100393 nd->send_to_net = 0;
Jens Axboeed92ac02007-02-06 14:43:52 +0100394 ret = fio_netio_setup_listen(td, port);
395 } else {
Jens Axboeb5af8292007-03-08 12:43:13 +0100396 nd->send_to_net = 1;
Jens Axboeed92ac02007-02-06 14:43:52 +0100397 ret = fio_netio_setup_connect(td, host, port);
398 }
399
Jens Axboe7bb48f82007-03-27 15:30:28 +0200400 return ret;
Jens Axboeed92ac02007-02-06 14:43:52 +0100401}
402
Jens Axboeb5af8292007-03-08 12:43:13 +0100403static void fio_netio_cleanup(struct thread_data *td)
Jens Axboe9bec88e2007-03-02 08:55:48 +0100404{
Jens Axboeb5af8292007-03-08 12:43:13 +0100405 struct netio_data *nd = td->io_ops->data;
406
407 if (nd) {
Jens Axboe64b24cd2007-06-24 21:28:39 +0200408 if (nd->listenfd != -1)
409 close(nd->listenfd);
410 if (nd->pipes[0] != -1)
411 close(nd->pipes[0]);
412 if (nd->pipes[1] != -1)
413 close(nd->pipes[1]);
414
Jens Axboeb5af8292007-03-08 12:43:13 +0100415 free(nd);
416 td->io_ops->data = NULL;
417 }
418}
419
420static int fio_netio_setup(struct thread_data *td)
421{
Jens Axboe7bb48f82007-03-27 15:30:28 +0200422 struct netio_data *nd;
Jens Axboeb5af8292007-03-08 12:43:13 +0100423
Jens Axboe7bb48f82007-03-27 15:30:28 +0200424 if (!td->io_ops->data) {
425 nd = malloc(sizeof(*nd));;
426
427 memset(nd, 0, sizeof(*nd));
428 nd->listenfd = -1;
Jens Axboe64b24cd2007-06-24 21:28:39 +0200429 nd->pipes[0] = nd->pipes[1] = -1;
Jens Axboe7bb48f82007-03-27 15:30:28 +0200430 td->io_ops->data = nd;
Jens Axboe7bb48f82007-03-27 15:30:28 +0200431 }
432
Jens Axboe9bec88e2007-03-02 08:55:48 +0100433 return 0;
434}
435
Jens Axboe9cce02e2007-06-22 15:42:21 +0200436static int fio_netio_setup_splice(struct thread_data *td)
437{
438 struct netio_data *nd;
439
440 fio_netio_setup(td);
441
442 nd = td->io_ops->data;
443 if (nd) {
444 if (pipe(nd->pipes) < 0)
445 return 1;
446
447 nd->use_splice = 1;
448 return 0;
449 }
450
451 return 1;
452}
453
454static struct ioengine_ops ioengine_rw = {
Jens Axboeed92ac02007-02-06 14:43:52 +0100455 .name = "net",
456 .version = FIO_IOOPS_VERSION,
Jens Axboeed92ac02007-02-06 14:43:52 +0100457 .prep = fio_netio_prep,
458 .queue = fio_netio_queue,
Jens Axboeed92ac02007-02-06 14:43:52 +0100459 .setup = fio_netio_setup,
Jens Axboe9bec88e2007-03-02 08:55:48 +0100460 .init = fio_netio_init,
Jens Axboeb5af8292007-03-08 12:43:13 +0100461 .cleanup = fio_netio_cleanup,
462 .open_file = fio_netio_open_file,
463 .close_file = generic_close_file,
464 .flags = FIO_SYNCIO | FIO_DISKLESSIO,
Jens Axboeed92ac02007-02-06 14:43:52 +0100465};
466
Jens Axboe9cce02e2007-06-22 15:42:21 +0200467static struct ioengine_ops ioengine_splice = {
468 .name = "netsplice",
469 .version = FIO_IOOPS_VERSION,
470 .prep = fio_netio_prep,
471 .queue = fio_netio_queue,
472 .setup = fio_netio_setup_splice,
473 .init = fio_netio_init,
474 .cleanup = fio_netio_cleanup,
475 .open_file = fio_netio_open_file,
476 .close_file = generic_close_file,
477 .flags = FIO_SYNCIO | FIO_DISKLESSIO,
478};
479
Jens Axboeed92ac02007-02-06 14:43:52 +0100480static void fio_init fio_netio_register(void)
481{
Jens Axboe9cce02e2007-06-22 15:42:21 +0200482 register_ioengine(&ioengine_rw);
483 register_ioengine(&ioengine_splice);
Jens Axboeed92ac02007-02-06 14:43:52 +0100484}
485
486static void fio_exit fio_netio_unregister(void)
487{
Jens Axboe9cce02e2007-06-22 15:42:21 +0200488 unregister_ioengine(&ioengine_rw);
489 unregister_ioengine(&ioengine_splice);
Jens Axboeed92ac02007-02-06 14:43:52 +0100490}