engines/rbd: issue initial flush to enable writeback/around mode
[fio.git] / engines / rbd.c
index 336837e9d812bb0119308a62620a4cb2b1382003..c6203d4c2a68173da20073f3f75863b6ec63ed38 100644 (file)
@@ -240,6 +240,17 @@ static int _fio_rbd_connect(struct thread_data *td)
                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;