From 2b728756ade8545c340f8758125a7de83c0f0f4b Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Mon, 8 Feb 2021 06:58:05 -0500 Subject: [PATCH] engine/rados: Add option to skip object creation When `touch_objects` is false, connection procedure no longer attempts to create objects. In such case ceph caches are untouched and do not affect quality of performance measurement. But if `touch_object` is false, tests that read objects without creating them previously will now fail. Signed-off-by: Adam Kupczyk --- HOWTO | 6 ++++++ engines/rados.c | 19 ++++++++++++++++--- fio.1 | 5 +++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/HOWTO b/HOWTO index b6d1b58a..cb6e5597 100644 --- a/HOWTO +++ b/HOWTO @@ -2294,6 +2294,12 @@ with the caveat that when used on the command line, they must come after the Poll store instead of waiting for completion. Usually this provides better throughput at cost of higher(up to 100%) CPU utilization. +.. option:: touch_objects=bool : [rados] + + During initialization, touch (create if do not exist) all objects (files). + Touching all objects affects ceph caches and likely impacts test results. + Enabled by default. + .. option:: skip_bad=bool : [mtd] Skip operations against known bad blocks. diff --git a/engines/rados.c b/engines/rados.c index 42ee48ff..23e62c4c 100644 --- a/engines/rados.c +++ b/engines/rados.c @@ -38,6 +38,7 @@ struct rados_options { char *pool_name; char *client_name; int busy_poll; + int touch_objects; }; static struct fio_option options[] = { @@ -78,6 +79,16 @@ static struct fio_option options[] = { .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_RBD, }, + { + .name = "touch_objects", + .lname = "touch objects on start", + .type = FIO_OPT_BOOL, + .help = "Touch (create) objects on start", + .off1 = offsetof(struct rados_options, touch_objects), + .def = "1", + .category = FIO_OPT_C_ENGINE, + .group = FIO_OPT_G_RBD, + }, { .name = NULL, }, @@ -194,9 +205,11 @@ static int _fio_rados_connect(struct thread_data *td) for (i = 0; i < td->o.nr_files; i++) { f = td->files[i]; f->real_file_size = file_size; - r = rados_write(rados->io_ctx, f->file_name, "", 0, 0); - if (r < 0) { - goto failed_obj_create; + if (o->touch_objects) { + r = rados_write(rados->io_ctx, f->file_name, "", 0, 0); + if (r < 0) { + goto failed_obj_create; + } } } return 0; diff --git a/fio.1 b/fio.1 index aa248a3b..1cafc74d 100644 --- a/fio.1 +++ b/fio.1 @@ -2049,6 +2049,11 @@ by default. Poll store instead of waiting for completion. Usually this provides better throughput at cost of higher(up to 100%) CPU utilization. .TP +.BI (rados)touch_objects \fR=\fPbool +During initialization, touch (create if do not exist) all objects (files). +Touching all objects affects ceph caches and likely impacts test results. +Enabled by default. +.TP .BI (http)http_host \fR=\fPstr Hostname to connect to. For S3, this could be the bucket name. Default is \fBlocalhost\fR -- 2.25.1