qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: adamcrume@gmail.com
To: qemu-devel@nongnu.org
Cc: Adam Crume <adamcrume@gmail.com>
Subject: [Qemu-devel] [PATCH] rbd: Add support for bdrv_invalidate_cache
Date: Thu,  9 Oct 2014 11:44:32 -0700	[thread overview]
Message-ID: <1412880272-3154-1-git-send-email-adamcrume@gmail.com> (raw)

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

             reply	other threads:[~2014-10-09 19:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-09 18:44 adamcrume [this message]
2014-10-09 21:05 ` [Qemu-devel] [PATCH] rbd: Add support for bdrv_invalidate_cache Josh Durgin
2014-10-10  9:22 ` Stefan Hajnoczi
2014-10-28 15:06 ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412880272-3154-1-git-send-email-adamcrume@gmail.com \
    --to=adamcrume@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).