Lines Matching refs:rbd
81 struct rbd_data *rbd; in _fio_setup_rbd_data() local
86 rbd = calloc(1, sizeof(struct rbd_data)); in _fio_setup_rbd_data()
87 if (!rbd) in _fio_setup_rbd_data()
90 rbd->aio_events = calloc(td->o.iodepth, sizeof(struct io_u *)); in _fio_setup_rbd_data()
91 if (!rbd->aio_events) in _fio_setup_rbd_data()
94 rbd->sort_events = calloc(td->o.iodepth, sizeof(struct io_u *)); in _fio_setup_rbd_data()
95 if (!rbd->sort_events) in _fio_setup_rbd_data()
98 *rbd_data_ptr = rbd; in _fio_setup_rbd_data()
102 if (rbd) in _fio_setup_rbd_data()
103 free(rbd); in _fio_setup_rbd_data()
110 struct rbd_data *rbd = td->io_ops->data; in _fio_rbd_connect() local
114 r = rados_create(&rbd->cluster, o->client_name); in _fio_rbd_connect()
120 r = rados_conf_read_file(rbd->cluster, NULL); in _fio_rbd_connect()
126 r = rados_connect(rbd->cluster); in _fio_rbd_connect()
132 r = rados_ioctx_create(rbd->cluster, o->pool_name, &rbd->io_ctx); in _fio_rbd_connect()
138 r = rbd_open(rbd->io_ctx, o->rbd_name, &rbd->image, NULL /*snap */ ); in _fio_rbd_connect()
146 rados_ioctx_destroy(rbd->io_ctx); in _fio_rbd_connect()
147 rbd->io_ctx = NULL; in _fio_rbd_connect()
149 rados_shutdown(rbd->cluster); in _fio_rbd_connect()
150 rbd->cluster = NULL; in _fio_rbd_connect()
155 static void _fio_rbd_disconnect(struct rbd_data *rbd) in _fio_rbd_disconnect() argument
157 if (!rbd) in _fio_rbd_disconnect()
161 if (rbd->image) { in _fio_rbd_disconnect()
162 rbd_close(rbd->image); in _fio_rbd_disconnect()
163 rbd->image = NULL; in _fio_rbd_disconnect()
166 if (rbd->io_ctx) { in _fio_rbd_disconnect()
167 rados_ioctx_destroy(rbd->io_ctx); in _fio_rbd_disconnect()
168 rbd->io_ctx = NULL; in _fio_rbd_disconnect()
171 if (rbd->cluster) { in _fio_rbd_disconnect()
172 rados_shutdown(rbd->cluster); in _fio_rbd_disconnect()
173 rbd->cluster = NULL; in _fio_rbd_disconnect()
200 struct rbd_data *rbd = td->io_ops->data; in fio_rbd_event() local
202 return rbd->aio_events[event]; in fio_rbd_event()
205 static inline int fri_check_complete(struct rbd_data *rbd, struct io_u *io_u, in fri_check_complete() argument
212 rbd->aio_events[*events] = io_u; in fri_check_complete()
256 struct rbd_data *rbd = td->io_ops->data; in rbd_iter_events() local
268 if (fri_check_complete(rbd, io_u, events)) in rbd_iter_events()
271 rbd->sort_events[sidx++] = io_u; in rbd_iter_events()
283 qsort(rbd->sort_events, sidx, sizeof(struct io_u *), rbd_io_u_cmp); in rbd_iter_events()
286 io_u = rbd->sort_events[i]; in rbd_iter_events()
288 if (fri_check_complete(rbd, io_u, events)) { in rbd_iter_events()
302 if (fri_check_complete(rbd, io_u, events)) in rbd_iter_events()
335 struct rbd_data *rbd = td->io_ops->data; in fio_rbd_queue() local
352 r = rbd_aio_write(rbd->image, io_u->offset, io_u->xfer_buflen, in fio_rbd_queue()
360 r = rbd_aio_read(rbd->image, io_u->offset, io_u->xfer_buflen, in fio_rbd_queue()
368 r = rbd_aio_discard(rbd->image, io_u->offset, in fio_rbd_queue()
375 r = rbd_aio_flush(rbd->image, fri->completion); in fio_rbd_queue()
413 struct rbd_data *rbd = td->io_ops->data; in fio_rbd_cleanup() local
415 if (rbd) { in fio_rbd_cleanup()
416 _fio_rbd_disconnect(rbd); in fio_rbd_cleanup()
417 free(rbd->aio_events); in fio_rbd_cleanup()
418 free(rbd->sort_events); in fio_rbd_cleanup()
419 free(rbd); in fio_rbd_cleanup()
427 struct rbd_data *rbd = NULL; in fio_rbd_setup() local
436 r = _fio_setup_rbd_data(td, &rbd); in fio_rbd_setup()
441 td->io_ops->data = rbd; in fio_rbd_setup()
460 r = rbd_stat(rbd->image, &info, sizeof(info)); in fio_rbd_setup()
482 _fio_rbd_disconnect(rbd); in fio_rbd_setup()
486 _fio_rbd_disconnect(rbd); in fio_rbd_setup()
500 struct rbd_data *rbd = td->io_ops->data; in fio_rbd_invalidate() local
502 return rbd_invalidate_cache(rbd->image); in fio_rbd_invalidate()