#include "../fio.h"
#include "../optgroup.h"
+#ifdef CONFIG_RBD_BLKIN
+#include <zipkin_c.h>
+#endif
struct fio_rbd_iou {
struct io_u *io_u;
rbd_completion_t completion;
int io_seen;
int io_complete;
+#ifdef CONFIG_RBD_BLKIN
+ struct blkin_trace_info info;
+#endif
};
struct rbd_data {
char *client_name = NULL;
/*
- * If we specify cluser name, the rados_creat2
+ * If we specify cluser name, the rados_create2
* will not assume 'client.'. name is considered
* as a full type.id namestr
*/
- if (!index(o->client_name, '.')) {
- client_name = calloc(1, strlen("client.") +
- strlen(o->client_name) + 1);
- strcat(client_name, "client.");
- o->client_name = strcat(client_name, o->client_name);
+ if (o->client_name) {
+ if (!index(o->client_name, '.')) {
+ client_name = calloc(1, strlen("client.") +
+ strlen(o->client_name) + 1);
+ strcat(client_name, "client.");
+ strcat(client_name, o->client_name);
+ } else {
+ client_name = o->client_name;
+ }
}
+
r = rados_create2(&rbd->cluster, o->cluster_name,
- o->client_name, 0);
+ client_name, 0);
+
+ if (client_name && !index(o->client_name, '.'))
+ free(client_name);
} else
r = rados_create(&rbd->cluster, o->client_name);
}
if (io_u->ddir == DDIR_WRITE) {
+#ifdef CONFIG_RBD_BLKIN
+ blkin_init_trace_info(&fri->info);
+ r = rbd_aio_write_traced(rbd->image, io_u->offset, io_u->xfer_buflen,
+ io_u->xfer_buf, fri->completion, &fri->info);
+#else
r = rbd_aio_write(rbd->image, io_u->offset, io_u->xfer_buflen,
io_u->xfer_buf, fri->completion);
+#endif
if (r < 0) {
log_err("rbd_aio_write failed.\n");
goto failed_comp;
}
} else if (io_u->ddir == DDIR_READ) {
+#ifdef CONFIG_RBD_BLKIN
+ blkin_init_trace_info(&fri->info);
+ r = rbd_aio_read_traced(rbd->image, io_u->offset, io_u->xfer_buflen,
+ io_u->xfer_buf, fri->completion, &fri->info);
+#else
r = rbd_aio_read(rbd->image, io_u->offset, io_u->xfer_buflen,
io_u->xfer_buf, fri->completion);
+#endif
if (r < 0) {
log_err("rbd_aio_read failed.\n");