engine/rados: Add option to skip object creation
authorAdam Kupczyk <akupczyk@redhat.com>
Mon, 8 Feb 2021 11:58:05 +0000 (06:58 -0500)
committerAdam Kupczyk <akupczyk@redhat.com>
Tue, 16 Feb 2021 13:27:20 +0000 (14:27 +0100)
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 <akupczyk@redhat.com>
HOWTO
engines/rados.c
fio.1

diff --git a/HOWTO b/HOWTO
index b6d1b58a3af46147091fb1a3828362fff10b0e0a..cb6e559709e67389ea8650339b426b97e12e2c81 100644 (file)
--- 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.
index 42ee48ff02b3f6371027ab4cbcbc304aefbbea10..23e62c4c45e3c5bf15a9d646636d1cfe3cf49b0c 100644 (file)
@@ -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 aa248a3b6da62172a2ee0a27e5b345034ebfe7fd..1cafc74d4992b667899c9ba32926010b9724bacc 100644 (file)
--- 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