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

* Re: [Qemu-devel] [PATCH] rbd: Add support for bdrv_invalidate_cache
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Josh Durgin @ 2014-10-09 21:05 UTC (permalink / raw)
  To: adamcrume, qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi

[adding block maintainers to cc]

On 10/09/2014 11:44 AM, adamcrume@gmail.com wrote:
> 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;

No return needed here. With that fixed:

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

> +}
> +#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)
>

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

* Re: [Qemu-devel] [PATCH] rbd: Add support for bdrv_invalidate_cache
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-10-10  9:22 UTC (permalink / raw)
  To: adamcrume; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

On Thu, Oct 09, 2014 at 11:44:32AM -0700, adamcrume@gmail.com wrote:
> From: Adam Crume <adamcrume@gmail.com>
> 
> This fixes Ceph issue 2467.

A link would be nice:
http://tracker.ceph.com/issues/2467

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [Qemu-devel] [PATCH] rbd: Add support for bdrv_invalidate_cache
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2014-10-28 15:06 UTC (permalink / raw)
  To: adamcrume; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

On Thu, Oct 09, 2014 at 11:44:32AM -0700, adamcrume@gmail.com wrote:
> 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(+)

Added URL to commit description and dropped return statement as
requested by Josh.

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[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).