remove out-of-date comment
[fio.git] / engines / rbd.c
CommitLineData
fc5c0345
DG
1/*
2 * rbd engine
3 *
4 * IO engine using Ceph's librbd to test RADOS Block Devices.
5 *
6 */
7
8#include <rbd/librbd.h>
9
10#include "../fio.h"
d220c761 11#include "../optgroup.h"
a4c4c346 12#ifdef CONFIG_RBD_BLKIN
13#include <zipkin_c.h>
14#endif
fc5c0345 15
53b6c979
PL
16#ifdef CONFIG_RBD_POLL
17/* add for poll */
18#include <poll.h>
19#include <sys/eventfd.h>
20#endif
21
fc5c0345
DG
22struct fio_rbd_iou {
23 struct io_u *io_u;
d8b64af2 24 rbd_completion_t completion;
d8b64af2 25 int io_seen;
b8ecbef6 26 int io_complete;
550beaad 27#ifdef CONFIG_RBD_BLKIN
a4c4c346 28 struct blkin_trace_info info;
550beaad 29#endif
fc5c0345
DG
30};
31
32struct rbd_data {
33 rados_t cluster;
34 rados_ioctx_t io_ctx;
35 rbd_image_t image;
36 struct io_u **aio_events;
6f9961ac 37 struct io_u **sort_events;
53b6c979 38 int fd; /* add for poll */
e0f35b53 39 bool connected;
fc5c0345
DG
40};
41
42struct rbd_options {
a1f871c7 43 void *pad;
6e20c6e7 44 char *cluster_name;
fc5c0345
DG
45 char *rbd_name;
46 char *pool_name;
47 char *client_name;
d7d702c7 48 int busy_poll;
fc5c0345
DG
49};
50
51static struct fio_option options[] = {
6e20c6e7
T
52 {
53 .name = "clustername",
54 .lname = "ceph cluster name",
55 .type = FIO_OPT_STR_STORE,
56 .help = "Cluster name for ceph",
57 .off1 = offsetof(struct rbd_options, cluster_name),
58 .category = FIO_OPT_C_ENGINE,
59 .group = FIO_OPT_G_RBD,
60 },
fc5c0345 61 {
d8b64af2
JA
62 .name = "rbdname",
63 .lname = "rbd engine rbdname",
64 .type = FIO_OPT_STR_STORE,
65 .help = "RBD name for RBD engine",
66 .off1 = offsetof(struct rbd_options, rbd_name),
67 .category = FIO_OPT_C_ENGINE,
68 .group = FIO_OPT_G_RBD,
69 },
fc5c0345 70 {
d7d702c7
JA
71 .name = "pool",
72 .lname = "rbd engine pool",
73 .type = FIO_OPT_STR_STORE,
74 .help = "Name of the pool hosting the RBD for the RBD engine",
75 .off1 = offsetof(struct rbd_options, pool_name),
76 .category = FIO_OPT_C_ENGINE,
77 .group = FIO_OPT_G_RBD,
d8b64af2 78 },
fc5c0345 79 {
d7d702c7
JA
80 .name = "clientname",
81 .lname = "rbd engine clientname",
82 .type = FIO_OPT_STR_STORE,
83 .help = "Name of the ceph client to access the RBD for the RBD engine",
84 .off1 = offsetof(struct rbd_options, client_name),
85 .category = FIO_OPT_C_ENGINE,
86 .group = FIO_OPT_G_RBD,
87 },
88 {
89 .name = "busy_poll",
90 .lname = "Busy poll",
91 .type = FIO_OPT_BOOL,
92 .help = "Busy poll for completions instead of sleeping",
fea585d4 93 .off1 = offsetof(struct rbd_options, busy_poll),
d7d702c7
JA
94 .def = "0",
95 .category = FIO_OPT_C_ENGINE,
96 .group = FIO_OPT_G_RBD,
d8b64af2 97 },
fc5c0345 98 {
d8b64af2
JA
99 .name = NULL,
100 },
fc5c0345
DG
101};
102
103static int _fio_setup_rbd_data(struct thread_data *td,
104 struct rbd_data **rbd_data_ptr)
105{
6f9961ac 106 struct rbd_data *rbd;
fc5c0345 107
565e784d 108 if (td->io_ops_data)
fc5c0345
DG
109 return 0;
110
6f9961ac
JA
111 rbd = calloc(1, sizeof(struct rbd_data));
112 if (!rbd)
fc5c0345
DG
113 goto failed;
114
e0f35b53
PL
115 rbd->connected = false;
116
53b6c979
PL
117 /* add for poll, init fd: -1 */
118 rbd->fd = -1;
53b6c979 119
6f9961ac
JA
120 rbd->aio_events = calloc(td->o.iodepth, sizeof(struct io_u *));
121 if (!rbd->aio_events)
fc5c0345
DG
122 goto failed;
123
6f9961ac
JA
124 rbd->sort_events = calloc(td->o.iodepth, sizeof(struct io_u *));
125 if (!rbd->sort_events)
126 goto failed;
fc5c0345 127
6f9961ac 128 *rbd_data_ptr = rbd;
fc5c0345
DG
129 return 0;
130
131failed:
5a4adfd2
JQ
132 if (rbd) {
133 if (rbd->aio_events)
134 free(rbd->aio_events);
135 if (rbd->sort_events)
136 free(rbd->sort_events);
6f9961ac 137 free(rbd);
5a4adfd2 138 }
fc5c0345
DG
139 return 1;
140
141}
142
73ae55c3
JA
143#ifdef CONFIG_RBD_POLL
144static bool _fio_rbd_setup_poll(struct rbd_data *rbd)
145{
146 int r;
147
148 /* add for rbd poll */
149 rbd->fd = eventfd(0, EFD_NONBLOCK);
150 if (rbd->fd < 0) {
151 log_err("eventfd failed.\n");
152 return false;
153 }
154
155 r = rbd_set_image_notification(rbd->image, rbd->fd, EVENT_TYPE_EVENTFD);
156 if (r < 0) {
157 log_err("rbd_set_image_notification failed.\n");
158 close(rbd->fd);
159 rbd->fd = -1;
160 return false;
161 }
162
163 return true;
164}
165#else
166static bool _fio_rbd_setup_poll(struct rbd_data *rbd)
167{
168 return true;
169}
170#endif
171
fc5c0345
DG
172static int _fio_rbd_connect(struct thread_data *td)
173{
565e784d 174 struct rbd_data *rbd = td->io_ops_data;
fc5c0345
DG
175 struct rbd_options *o = td->eo;
176 int r;
177
6e20c6e7
T
178 if (o->cluster_name) {
179 char *client_name = NULL;
180
181 /*
89e5ec96 182 * If we specify cluser name, the rados_create2
6e20c6e7
T
183 * will not assume 'client.'. name is considered
184 * as a full type.id namestr
185 */
89e5ec96
JQ
186 if (o->client_name) {
187 if (!index(o->client_name, '.')) {
188 client_name = calloc(1, strlen("client.") +
189 strlen(o->client_name) + 1);
190 strcat(client_name, "client.");
6ec0dcd1
JQ
191 strcat(client_name, o->client_name);
192 } else {
193 client_name = o->client_name;
89e5ec96 194 }
6e20c6e7 195 }
6ec0dcd1 196
6e20c6e7 197 r = rados_create2(&rbd->cluster, o->cluster_name,
6ec0dcd1
JQ
198 client_name, 0);
199
200 if (client_name && !index(o->client_name, '.'))
201 free(client_name);
6e20c6e7
T
202 } else
203 r = rados_create(&rbd->cluster, o->client_name);
204
fc5c0345
DG
205 if (r < 0) {
206 log_err("rados_create failed.\n");
207 goto failed_early;
208 }
209
6f9961ac 210 r = rados_conf_read_file(rbd->cluster, NULL);
fc5c0345
DG
211 if (r < 0) {
212 log_err("rados_conf_read_file failed.\n");
213 goto failed_early;
214 }
215
6f9961ac 216 r = rados_connect(rbd->cluster);
fc5c0345
DG
217 if (r < 0) {
218 log_err("rados_connect failed.\n");
219 goto failed_shutdown;
220 }
221
6f9961ac 222 r = rados_ioctx_create(rbd->cluster, o->pool_name, &rbd->io_ctx);
fc5c0345
DG
223 if (r < 0) {
224 log_err("rados_ioctx_create failed.\n");
225 goto failed_shutdown;
226 }
227
6f9961ac 228 r = rbd_open(rbd->io_ctx, o->rbd_name, &rbd->image, NULL /*snap */ );
fc5c0345
DG
229 if (r < 0) {
230 log_err("rbd_open failed.\n");
231 goto failed_open;
232 }
53b6c979 233
73ae55c3
JA
234 if (!_fio_rbd_setup_poll(rbd))
235 goto failed_poll;
53b6c979 236
fc5c0345
DG
237 return 0;
238
73ae55c3
JA
239failed_poll:
240 rbd_close(rbd->image);
241 rbd->image = NULL;
fc5c0345 242failed_open:
6f9961ac
JA
243 rados_ioctx_destroy(rbd->io_ctx);
244 rbd->io_ctx = NULL;
fc5c0345 245failed_shutdown:
6f9961ac
JA
246 rados_shutdown(rbd->cluster);
247 rbd->cluster = NULL;
fc5c0345
DG
248failed_early:
249 return 1;
250}
251
6f9961ac 252static void _fio_rbd_disconnect(struct rbd_data *rbd)
fc5c0345 253{
6f9961ac 254 if (!rbd)
fc5c0345
DG
255 return;
256
53b6c979 257 /* close eventfd */
73ae55c3 258 if (rbd->fd != -1) {
53b6c979
PL
259 close(rbd->fd);
260 rbd->fd = -1;
261 }
53b6c979 262
fc5c0345 263 /* shutdown everything */
6f9961ac
JA
264 if (rbd->image) {
265 rbd_close(rbd->image);
266 rbd->image = NULL;
fc5c0345
DG
267 }
268
6f9961ac
JA
269 if (rbd->io_ctx) {
270 rados_ioctx_destroy(rbd->io_ctx);
271 rbd->io_ctx = NULL;
fc5c0345
DG
272 }
273
6f9961ac
JA
274 if (rbd->cluster) {
275 rados_shutdown(rbd->cluster);
276 rbd->cluster = NULL;
fc5c0345
DG
277 }
278}
279
d8b64af2 280static void _fio_rbd_finish_aiocb(rbd_completion_t comp, void *data)
fc5c0345 281{
dbf388d2
JA
282 struct fio_rbd_iou *fri = data;
283 struct io_u *io_u = fri->io_u;
d8b64af2 284 ssize_t ret;
fc5c0345 285
d8b64af2
JA
286 /*
287 * Looks like return value is 0 for success, or < 0 for
288 * a specific error. So we have to assume that it can't do
289 * partial completions.
290 */
291 ret = rbd_aio_get_return_value(fri->completion);
292 if (ret < 0) {
293 io_u->error = ret;
294 io_u->resid = io_u->xfer_buflen;
295 } else
296 io_u->error = 0;
20cf5aab
JD
297
298 fri->io_complete = 1;
d8b64af2 299}
fc5c0345 300
d8b64af2
JA
301static struct io_u *fio_rbd_event(struct thread_data *td, int event)
302{
565e784d 303 struct rbd_data *rbd = td->io_ops_data;
fc5c0345 304
6f9961ac 305 return rbd->aio_events[event];
fc5c0345
DG
306}
307
6f9961ac 308static inline int fri_check_complete(struct rbd_data *rbd, struct io_u *io_u,
d8b64af2 309 unsigned int *events)
fc5c0345 310{
d8b64af2 311 struct fio_rbd_iou *fri = io_u->engine_data;
fc5c0345 312
b8ecbef6 313 if (fri->io_complete) {
d8b64af2 314 fri->io_seen = 1;
6f9961ac 315 rbd->aio_events[*events] = io_u;
d8b64af2 316 (*events)++;
fc5c0345 317
d8b64af2
JA
318 rbd_aio_release(fri->completion);
319 return 1;
320 }
fc5c0345 321
d8b64af2 322 return 0;
fc5c0345
DG
323}
324
6f9961ac
JA
325static inline int rbd_io_u_seen(struct io_u *io_u)
326{
327 struct fio_rbd_iou *fri = io_u->engine_data;
328
329 return fri->io_seen;
330}
331
332static void rbd_io_u_wait_complete(struct io_u *io_u)
333{
334 struct fio_rbd_iou *fri = io_u->engine_data;
335
336 rbd_aio_wait_for_complete(fri->completion);
337}
338
339static int rbd_io_u_cmp(const void *p1, const void *p2)
340{
341 const struct io_u **a = (const struct io_u **) p1;
342 const struct io_u **b = (const struct io_u **) p2;
343 uint64_t at, bt;
344
345 at = utime_since_now(&(*a)->start_time);
346 bt = utime_since_now(&(*b)->start_time);
347
348 if (at < bt)
349 return -1;
350 else if (at == bt)
351 return 0;
352 else
353 return 1;
354}
355
d8b64af2
JA
356static int rbd_iter_events(struct thread_data *td, unsigned int *events,
357 unsigned int min_evts, int wait)
82340a9f 358{
565e784d 359 struct rbd_data *rbd = td->io_ops_data;
d8b64af2
JA
360 unsigned int this_events = 0;
361 struct io_u *io_u;
53b6c979
PL
362 int i, sidx = 0;
363
364#ifdef CONFIG_RBD_POLL
365 int ret = 0;
366 int event_num = 0;
367 struct fio_rbd_iou *fri = NULL;
368 rbd_completion_t comps[min_evts];
82340a9f 369
53b6c979
PL
370 struct pollfd pfd;
371 pfd.fd = rbd->fd;
372 pfd.events = POLLIN;
373
374 ret = poll(&pfd, 1, -1);
73ae55c3 375 if (ret <= 0)
53b6c979 376 return 0;
73ae55c3 377
53b6c979
PL
378 assert(pfd.revents & POLLIN);
379
380 event_num = rbd_poll_io_events(rbd->image, comps, min_evts);
381
382 for (i = 0; i < event_num; i++) {
383 fri = rbd_aio_get_arg(comps[i]);
384 io_u = fri->io_u;
385#else
d8b64af2 386 io_u_qiter(&td->io_u_all, io_u, i) {
53b6c979 387#endif
d8b64af2
JA
388 if (!(io_u->flags & IO_U_F_FLIGHT))
389 continue;
6f9961ac 390 if (rbd_io_u_seen(io_u))
d8b64af2 391 continue;
82340a9f 392
6f9961ac 393 if (fri_check_complete(rbd, io_u, events))
d8b64af2 394 this_events++;
6f9961ac
JA
395 else if (wait)
396 rbd->sort_events[sidx++] = io_u;
397 }
82340a9f 398
6f9961ac
JA
399 if (!wait || !sidx)
400 return this_events;
401
402 /*
403 * Sort events, oldest issue first, then wait on as many as we
404 * need in order of age. If we have enough events, stop waiting,
405 * and just check if any of the older ones are done.
406 */
407 if (sidx > 1)
408 qsort(rbd->sort_events, sidx, sizeof(struct io_u *), rbd_io_u_cmp);
409
410 for (i = 0; i < sidx; i++) {
411 io_u = rbd->sort_events[i];
412
413 if (fri_check_complete(rbd, io_u, events)) {
414 this_events++;
415 continue;
d8b64af2 416 }
6f9961ac
JA
417
418 /*
419 * Stop waiting when we have enough, but continue checking
420 * all pending IOs if they are complete.
421 */
d8b64af2 422 if (*events >= min_evts)
6f9961ac
JA
423 continue;
424
425 rbd_io_u_wait_complete(io_u);
426
427 if (fri_check_complete(rbd, io_u, events))
428 this_events++;
d8b64af2 429 }
fc5c0345 430
d8b64af2 431 return this_events;
fc5c0345
DG
432}
433
434static int fio_rbd_getevents(struct thread_data *td, unsigned int min,
1f440ece 435 unsigned int max, const struct timespec *t)
fc5c0345 436{
d8b64af2 437 unsigned int this_events, events = 0;
d7d702c7 438 struct rbd_options *o = td->eo;
d8b64af2 439 int wait = 0;
fc5c0345
DG
440
441 do {
d8b64af2 442 this_events = rbd_iter_events(td, &events, min, wait);
fc5c0345 443
d8b64af2 444 if (events >= min)
fc5c0345 445 break;
d8b64af2
JA
446 if (this_events)
447 continue;
fc5c0345 448
d7d702c7
JA
449 if (!o->busy_poll)
450 wait = 1;
451 else
452 nop;
fc5c0345
DG
453 } while (1);
454
455 return events;
456}
457
458static int fio_rbd_queue(struct thread_data *td, struct io_u *io_u)
459{
565e784d 460 struct rbd_data *rbd = td->io_ops_data;
d8b64af2
JA
461 struct fio_rbd_iou *fri = io_u->engine_data;
462 int r = -1;
fc5c0345
DG
463
464 fio_ro_check(td, io_u);
465
d8b64af2 466 fri->io_seen = 0;
b8ecbef6 467 fri->io_complete = 0;
d8b64af2 468
dbf388d2 469 r = rbd_aio_create_completion(fri, _fio_rbd_finish_aiocb,
d8b64af2 470 &fri->completion);
dbf388d2
JA
471 if (r < 0) {
472 log_err("rbd_aio_create_completion failed.\n");
473 goto failed;
474 }
fc5c0345 475
dbf388d2 476 if (io_u->ddir == DDIR_WRITE) {
a4c4c346 477#ifdef CONFIG_RBD_BLKIN
478 blkin_init_trace_info(&fri->info);
479 r = rbd_aio_write_traced(rbd->image, io_u->offset, io_u->xfer_buflen,
480 io_u->xfer_buf, fri->completion, &fri->info);
481#else
6f9961ac
JA
482 r = rbd_aio_write(rbd->image, io_u->offset, io_u->xfer_buflen,
483 io_u->xfer_buf, fri->completion);
a4c4c346 484#endif
fc5c0345
DG
485 if (r < 0) {
486 log_err("rbd_aio_write failed.\n");
dbf388d2 487 goto failed_comp;
fc5c0345
DG
488 }
489
490 } else if (io_u->ddir == DDIR_READ) {
a4c4c346 491#ifdef CONFIG_RBD_BLKIN
492 blkin_init_trace_info(&fri->info);
493 r = rbd_aio_read_traced(rbd->image, io_u->offset, io_u->xfer_buflen,
494 io_u->xfer_buf, fri->completion, &fri->info);
495#else
6f9961ac
JA
496 r = rbd_aio_read(rbd->image, io_u->offset, io_u->xfer_buflen,
497 io_u->xfer_buf, fri->completion);
a4c4c346 498#endif
fc5c0345
DG
499
500 if (r < 0) {
501 log_err("rbd_aio_read failed.\n");
dbf388d2 502 goto failed_comp;
fc5c0345 503 }
dbf388d2 504 } else if (io_u->ddir == DDIR_TRIM) {
6f9961ac
JA
505 r = rbd_aio_discard(rbd->image, io_u->offset,
506 io_u->xfer_buflen, fri->completion);
82340a9f 507 if (r < 0) {
dbf388d2
JA
508 log_err("rbd_aio_discard failed.\n");
509 goto failed_comp;
82340a9f 510 }
dbf388d2 511 } else if (io_u->ddir == DDIR_SYNC) {
6f9961ac 512 r = rbd_aio_flush(rbd->image, fri->completion);
fc5c0345
DG
513 if (r < 0) {
514 log_err("rbd_flush failed.\n");
dbf388d2 515 goto failed_comp;
fc5c0345 516 }
fc5c0345
DG
517 } else {
518 dprint(FD_IO, "%s: Warning: unhandled ddir: %d\n", __func__,
519 io_u->ddir);
dbf388d2 520 goto failed_comp;
fc5c0345
DG
521 }
522
523 return FIO_Q_QUEUED;
dbf388d2
JA
524failed_comp:
525 rbd_aio_release(fri->completion);
fc5c0345
DG
526failed:
527 io_u->error = r;
528 td_verror(td, io_u->error, "xfer");
529 return FIO_Q_COMPLETED;
530}
531
532static int fio_rbd_init(struct thread_data *td)
533{
534 int r;
e0f35b53 535 struct rbd_data *rbd = td->io_ops_data;
35448275
JA
536
537 if (rbd->connected)
e0f35b53 538 return 0;
fc5c0345
DG
539
540 r = _fio_rbd_connect(td);
541 if (r) {
542 log_err("fio_rbd_connect failed, return code: %d .\n", r);
543 goto failed;
544 }
545
546 return 0;
547
548failed:
549 return 1;
fc5c0345
DG
550}
551
552static void fio_rbd_cleanup(struct thread_data *td)
553{
565e784d 554 struct rbd_data *rbd = td->io_ops_data;
fc5c0345 555
6f9961ac
JA
556 if (rbd) {
557 _fio_rbd_disconnect(rbd);
558 free(rbd->aio_events);
559 free(rbd->sort_events);
560 free(rbd);
fc5c0345 561 }
fc5c0345
DG
562}
563
564static int fio_rbd_setup(struct thread_data *td)
565{
fc5c0345
DG
566 rbd_image_info_t info;
567 struct fio_file *f;
6f9961ac 568 struct rbd_data *rbd = NULL;
6f9961ac 569 int r;
fc5c0345 570
fc5c0345 571 /* allocate engine specific structure to deal with librbd. */
6f9961ac 572 r = _fio_setup_rbd_data(td, &rbd);
fc5c0345
DG
573 if (r) {
574 log_err("fio_setup_rbd_data failed.\n");
575 goto cleanup;
576 }
565e784d 577 td->io_ops_data = rbd;
fc5c0345 578
d8b64af2
JA
579 /* librbd does not allow us to run first in the main thread and later
580 * in a fork child. It needs to be the same process context all the
581 * time.
fc5c0345
DG
582 */
583 td->o.use_thread = 1;
584
585 /* connect in the main thread to determine to determine
586 * the size of the given RADOS block device. And disconnect
587 * later on.
588 */
589 r = _fio_rbd_connect(td);
590 if (r) {
591 log_err("fio_rbd_connect failed.\n");
592 goto cleanup;
593 }
e0f35b53 594 rbd->connected = true;
fc5c0345
DG
595
596 /* get size of the RADOS block device */
6f9961ac 597 r = rbd_stat(rbd->image, &info, sizeof(info));
fc5c0345
DG
598 if (r < 0) {
599 log_err("rbd_status failed.\n");
600 goto disconnect;
206c546d
PL
601 } else if (info.size == 0) {
602 log_err("image size should be larger than zero.\n");
603 r = -EINVAL;
604 goto disconnect;
fc5c0345 605 }
206c546d 606
fc5c0345
DG
607 dprint(FD_IO, "rbd-engine: image size: %lu\n", info.size);
608
609 /* taken from "net" engine. Pretend we deal with files,
610 * even if we do not have any ideas about files.
611 * The size of the RBD is set instead of a artificial file.
612 */
613 if (!td->files_index) {
5903e7b7 614 add_file(td, td->o.filename ? : "rbd", 0, 0);
fc5c0345 615 td->o.nr_files = td->o.nr_files ? : 1;
b53f2c54 616 td->o.open_files++;
fc5c0345
DG
617 }
618 f = td->files[0];
619 f->real_file_size = info.size;
620
fc5c0345
DG
621 return 0;
622
623disconnect:
6f9961ac 624 _fio_rbd_disconnect(rbd);
fc5c0345
DG
625cleanup:
626 fio_rbd_cleanup(td);
627 return r;
628}
629
630static int fio_rbd_open(struct thread_data *td, struct fio_file *f)
631{
632 return 0;
633}
634
d9b100fc
JA
635static int fio_rbd_invalidate(struct thread_data *td, struct fio_file *f)
636{
903b2812 637#if defined(CONFIG_RBD_INVAL)
565e784d 638 struct rbd_data *rbd = td->io_ops_data;
903b2812 639
6f9961ac 640 return rbd_invalidate_cache(rbd->image);
903b2812 641#else
d9b100fc 642 return 0;
903b2812 643#endif
d9b100fc
JA
644}
645
fc5c0345
DG
646static void fio_rbd_io_u_free(struct thread_data *td, struct io_u *io_u)
647{
d8b64af2 648 struct fio_rbd_iou *fri = io_u->engine_data;
fc5c0345 649
d8b64af2 650 if (fri) {
fc5c0345 651 io_u->engine_data = NULL;
d8b64af2 652 free(fri);
fc5c0345
DG
653 }
654}
655
656static int fio_rbd_io_u_init(struct thread_data *td, struct io_u *io_u)
657{
d8b64af2 658 struct fio_rbd_iou *fri;
fc5c0345 659
d8b64af2
JA
660 fri = calloc(1, sizeof(*fri));
661 fri->io_u = io_u;
662 io_u->engine_data = fri;
fc5c0345
DG
663 return 0;
664}
665
10aa136b 666static struct ioengine_ops ioengine = {
d9b100fc
JA
667 .name = "rbd",
668 .version = FIO_IOOPS_VERSION,
669 .setup = fio_rbd_setup,
670 .init = fio_rbd_init,
671 .queue = fio_rbd_queue,
672 .getevents = fio_rbd_getevents,
673 .event = fio_rbd_event,
674 .cleanup = fio_rbd_cleanup,
675 .open_file = fio_rbd_open,
676 .invalidate = fio_rbd_invalidate,
677 .options = options,
678 .io_u_init = fio_rbd_io_u_init,
679 .io_u_free = fio_rbd_io_u_free,
680 .option_struct_size = sizeof(struct rbd_options),
fc5c0345
DG
681};
682
683static void fio_init fio_rbd_register(void)
684{
685 register_ioengine(&ioengine);
686}
687
688static void fio_exit fio_rbd_unregister(void)
689{
690 unregister_ioengine(&ioengine);
691}