Skip to contentSkip to conversation

rbd : disable rbd_cache_writethrough_until_flush for cache=unsafe

PATCH In review Alexandre Derumier 2 participants 2 messages Jul 27, 2016 – Sep 22, 2016 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rbd : disable rbd_cache_writethrough_until_flush for cache=unsafe

ceph force writethrough until a flush is detected. With cache=unsafe, we never send flush.
So we need to tell to ceph
to set rbd_cache_writethrough_until_flush=false in this case.

This speedup a lot qemu-img convert which use cache=unsafe by default

---
 block/rbd.c | 4 ++++
 1 file changed, 4 insertions(+)
block/rbd.c +4 -0
index 0106fea..f3af6c8 100644
@@ -552,6 +552,10 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
         rados_conf_set(s->cluster, "rbd_cache", "true");
     }
 
+    if (flags & BDRV_O_NO_FLUSH) {
+        rados_conf_set(s->cluster, "rbd_cache_writethrough_until_flush", "false");
+    }
+
     r = rados_connect(s->cluster);
     if (r < 0) {
         error_setg_errno(errp, -r, "error connecting");
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Alexandre Derumier

ceph force writethrough until a flush is detected. With cache=unsafe, we never send flush.
So we need to tell to ceph
to set rbd_cache_writethrough_until_flush=false in this case.

This speedup a lot qemu-img convert which use cache=unsafe by default

Sorry for the delay - this is correct and needed since this option appeared by default in Ceph hammer.

Quoted 20 lines
---
 block/rbd.c | 4 ++++
 1 file changed, 4 insertions(+)
block/rbd.c +4 -0
index 0106fea..f3af6c8 100644
@@ -552,6 +552,10 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
         rados_conf_set(s->cluster, "rbd_cache", "true");
     }
 
+    if (flags & BDRV_O_NO_FLUSH) {
+        rados_conf_set(s->cluster, "rbd_cache_writethrough_until_flush", "false");
+    }
+
     r = rados_connect(s->cluster);
     if (r < 0) {
         error_setg_errno(errp, -r, "error connecting");