engines/rbd: add support for "direct=1" option
authorJason Dillaman <dillaman@redhat.com>
Wed, 2 Dec 2020 18:54:58 +0000 (13:54 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 2 Dec 2020 18:54:58 +0000 (13:54 -0500)
When direct IO is enabled, the librbd in-memory cache will be
automatically disabled.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
engines/rbd.c

index 268b6ebdffad2b71e4da565ed90867e76f90947a..336837e9d812bb0119308a62620a4cb2b1382003 100644 (file)
@@ -227,6 +227,13 @@ 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");