X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Frbd.c;h=2f25889ac877a09730bf6e037f5c9a3d7042dc64;hb=9dc528b1638b625b5e167983a74de4e85c5859ea;hp=cf7337f00745198f21cd23379ea3362c8e6ee3cd;hpb=d3b07186b1d4c7c1d9adc1306407458ce41ad048;p=fio.git diff --git a/engines/rbd.c b/engines/rbd.c index cf7337f0..2f25889a 100644 --- a/engines/rbd.c +++ b/engines/rbd.c @@ -173,7 +173,7 @@ static int _fio_rbd_connect(struct thread_data *td) char *client_name = NULL; /* - * If we specify cluser name, the rados_create2 + * If we specify cluster name, the rados_create2 * will not assume 'client.'. name is considered * as a full type.id namestr */ @@ -200,6 +200,14 @@ static int _fio_rbd_connect(struct thread_data *td) log_err("rados_create failed.\n"); goto failed_early; } + if (o->pool_name == NULL) { + log_err("rbd pool name must be provided.\n"); + goto failed_early; + } + if (!o->rbd_name) { + log_err("rbdname must be provided.\n"); + goto failed_early; + } r = rados_conf_read_file(rbd->cluster, NULL); if (r < 0) { @@ -219,12 +227,30 @@ static int _fio_rbd_connect(struct thread_data *td) goto failed_shutdown; } + if (td->o.odirect) { + r = rados_conf_set(rbd->cluster, "rbd_cache", "false"); + if (r < 0) { + log_info("failed to disable RBD in-memory cache\n"); + } + } + r = rbd_open(rbd->io_ctx, o->rbd_name, &rbd->image, NULL /*snap */ ); if (r < 0) { log_err("rbd_open failed.\n"); goto failed_open; } + if (!td->o.odirect) { + /* + * ensure cache enables writeback/around mode unless explicitly + * configured for writethrough mode + */ + r = rbd_flush(rbd->image); + if (r < 0) { + log_info("rbd: failed to issue initial flush\n"); + } + } + if (!_fio_rbd_setup_poll(rbd)) goto failed_poll; @@ -316,12 +342,14 @@ static inline int fri_check_complete(struct rbd_data *rbd, struct io_u *io_u, return 0; } +#ifndef CONFIG_RBD_POLL static inline int rbd_io_u_seen(struct io_u *io_u) { struct fio_rbd_iou *fri = io_u->engine_data; return fri->io_seen; } +#endif static void rbd_io_u_wait_complete(struct io_u *io_u) { @@ -462,8 +490,8 @@ static int fio_rbd_getevents(struct thread_data *td, unsigned int min, return events; } -static enum fio_q_status -fio_rbd_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status fio_rbd_queue(struct thread_data *td, + struct io_u *io_u) { struct rbd_data *rbd = td->io_ops_data; struct fio_rbd_iou *fri = io_u->engine_data; @@ -605,7 +633,7 @@ static int fio_rbd_setup(struct thread_data *td) /* taken from "net" engine. Pretend we deal with files, * even if we do not have any ideas about files. - * The size of the RBD is set instead of a artificial file. + * The size of the RBD is set instead of an artificial file. */ if (!td->files_index) { add_file(td, td->o.filename ? : "rbd", 0, 0); @@ -658,7 +686,7 @@ static int fio_rbd_io_u_init(struct thread_data *td, struct io_u *io_u) return 0; } -static struct ioengine_ops ioengine = { +FIO_STATIC struct ioengine_ops ioengine = { .name = "rbd", .version = FIO_IOOPS_VERSION, .setup = fio_rbd_setup,