qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] rbd: Add support for bdrv_invalidate_cache
@ 2014-10-09 18:44 adamcrume
  2014-10-09 21:05 ` Josh Durgin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: adamcrume @ 2014-10-09 18:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Adam Crume

From: Adam Crume <adamcrume@gmail.com>

This fixes Ceph issue 2467.

Signed-off-by: Adam Crume <adamcrume@gmail.com>
---
 block/rbd.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/block/rbd.c b/block/rbd.c
index 96947e3..d88ba70 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -887,6 +887,19 @@ static BlockDriverAIOCB* qemu_rbd_aio_discard(BlockDriverState *bs,
 }
 #endif
 
+#ifdef LIBRBD_SUPPORTS_INVALIDATE
+static void qemu_rbd_invalidate_cache(BlockDriverState *bs,
+                                      Error **errp)
+{
+    BDRVRBDState *s = bs->opaque;
+    int r = rbd_invalidate_cache(s->image);
+    if (r < 0) {
+        error_setg_errno(errp, -r, "Failed to invalidate the cache");
+    }
+    return r;
+}
+#endif
+
 static QemuOptsList qemu_rbd_create_opts = {
     .name = "rbd-create-opts",
     .head = QTAILQ_HEAD_INITIALIZER(qemu_rbd_create_opts.head),
@@ -936,6 +949,9 @@ static BlockDriver bdrv_rbd = {
     .bdrv_snapshot_delete   = qemu_rbd_snap_remove,
     .bdrv_snapshot_list     = qemu_rbd_snap_list,
     .bdrv_snapshot_goto     = qemu_rbd_snap_rollback,
+#ifdef LIBRBD_SUPPORTS_INVALIDATE
+    .bdrv_invalidate_cache  = qemu_rbd_invalidate_cache,
+#endif
 };
 
 static void bdrv_rbd_init(void)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-28 15:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-09 18:44 [Qemu-devel] [PATCH] rbd: Add support for bdrv_invalidate_cache adamcrume
2014-10-09 21:05 ` Josh Durgin
2014-10-10  9:22 ` Stefan Hajnoczi
2014-10-28 15:06 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).