From 8e4e151fe1f7e2548c4de268e085634696db4cb1 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 2 Dec 2020 14:03:42 -0500 Subject: [PATCH] engines/rbd: issue initial flush to enable writeback/around mode By default librbd will use a writethrough cache until it receives the first flush. Send a no-op flush after opening the image to ensure writearound (default) or writeback cache modes can be properly enabled (unlesss direct=1). Signed-off-by: Jason Dillaman --- engines/rbd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engines/rbd.c b/engines/rbd.c index 336837e9..c6203d4c 100644 --- a/engines/rbd.c +++ b/engines/rbd.c @@ -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; -- 2.25.1