Merge branch 'wip-rbd-engine-tweaks' of https://github.com/dillaman/fio
authorJens Axboe <axboe@kernel.dk>
Tue, 15 Dec 2020 16:18:28 +0000 (09:18 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 15 Dec 2020 16:18:28 +0000 (09:18 -0700)
* 'wip-rbd-engine-tweaks' of https://github.com/dillaman/fio:
  engines/rbd: issue initial flush to enable writeback/around mode
  engines/rbd: add support for "direct=1" option

engines/rbd.c

index 268b6ebdffad2b71e4da565ed90867e76f90947a..c6203d4c2a68173da20073f3f75863b6ec63ed38 100644 (file)
@@ -227,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;