* [Qemu-devel] [PATCH v2 1/2] block: Move declaration of bdrv_get_aio_context to block.h
2014-05-15 11:22 [Qemu-devel] [PATCH v2 0/2] dataplane: Enable config-wce Fam Zheng
@ 2014-05-15 11:22 ` Fam Zheng
2014-05-15 11:22 ` [Qemu-devel] [PATCH v2 2/2] virtio-blk: Allow config-wce in dataplane Fam Zheng
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Fam Zheng @ 2014-05-15 11:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Stefan Hajnoczi
block_int.h is for block layer and block drivers, other code shouldn't
include it. But similar to bdrv_set_aio_context, bdrv_get_aio_context
should also be accessible from outside of block layer.
Move it.
Signed-off-by: Fam Zheng <famz@redhat.com>
---
include/block/block.h | 7 +++++++
include/block/block_int.h | 7 -------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/block/block.h b/include/block/block.h
index d223e33..6676d1f 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -534,6 +534,13 @@ int bdrv_debug_resume(BlockDriverState *bs, const char *tag);
bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag);
/**
+ * bdrv_get_aio_context:
+ *
+ * Returns: the currently bound #AioContext
+ */
+AioContext *bdrv_get_aio_context(BlockDriverState *bs);
+
+/**
* bdrv_set_aio_context:
*
* Changes the #AioContext used for fd handlers, timers, and BHs by this
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 47c79b3..a9301d5 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -397,13 +397,6 @@ void bdrv_add_before_write_notifier(BlockDriverState *bs,
NotifierWithReturn *notifier);
/**
- * bdrv_get_aio_context:
- *
- * Returns: the currently bound #AioContext
- */
-AioContext *bdrv_get_aio_context(BlockDriverState *bs);
-
-/**
* bdrv_detach_aio_context:
*
* May be called from .bdrv_detach_aio_context() to detach children from the
--
1.9.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] virtio-blk: Allow config-wce in dataplane
2014-05-15 11:22 [Qemu-devel] [PATCH v2 0/2] dataplane: Enable config-wce Fam Zheng
2014-05-15 11:22 ` [Qemu-devel] [PATCH v2 1/2] block: Move declaration of bdrv_get_aio_context to block.h Fam Zheng
@ 2014-05-15 11:22 ` Fam Zheng
2014-05-15 12:35 ` [Qemu-devel] [PATCH v2 0/2] dataplane: Enable config-wce Paolo Bonzini
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Fam Zheng @ 2014-05-15 11:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Stefan Hajnoczi
Dataplane now uses block layer. Protect bdrv_set_enable_write_cache with
aio_context_acquire and aio_context_release, so we can enable config-wce
to allow guest to modify the write cache online.
Signed-off-by: Fam Zheng <famz@redhat.com>
---
hw/block/dataplane/virtio-blk.c | 6 ------
hw/block/virtio-blk.c | 8 +++++++-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 79fb612..46a6824 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -332,12 +332,6 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
return;
}
- if (blk->config_wce) {
- error_setg(errp, "device is incompatible with x-data-plane, "
- "use config-wce=off");
- return;
- }
-
/* If dataplane is (re-)enabled while the guest is running there could be
* block jobs that can conflict.
*/
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 8a568e5..5e9433d 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -523,7 +523,10 @@ static void virtio_blk_set_config(VirtIODevice *vdev, const uint8_t *config)
struct virtio_blk_config blkcfg;
memcpy(&blkcfg, config, sizeof(blkcfg));
+
+ aio_context_acquire(bdrv_get_aio_context(s->bs));
bdrv_set_enable_write_cache(s->bs, blkcfg.wce != 0);
+ aio_context_release(bdrv_get_aio_context(s->bs));
}
static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features)
@@ -582,7 +585,10 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status)
* s->bs would erroneously be placed in writethrough mode.
*/
if (!(features & (1 << VIRTIO_BLK_F_CONFIG_WCE))) {
- bdrv_set_enable_write_cache(s->bs, !!(features & (1 << VIRTIO_BLK_F_WCE)));
+ aio_context_acquire(bdrv_get_aio_context(s->bs));
+ bdrv_set_enable_write_cache(s->bs,
+ !!(features & (1 << VIRTIO_BLK_F_WCE)));
+ aio_context_release(bdrv_get_aio_context(s->bs));
}
}
--
1.9.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] dataplane: Enable config-wce
2014-05-15 11:22 [Qemu-devel] [PATCH v2 0/2] dataplane: Enable config-wce Fam Zheng
2014-05-15 11:22 ` [Qemu-devel] [PATCH v2 1/2] block: Move declaration of bdrv_get_aio_context to block.h Fam Zheng
2014-05-15 11:22 ` [Qemu-devel] [PATCH v2 2/2] virtio-blk: Allow config-wce in dataplane Fam Zheng
@ 2014-05-15 12:35 ` Paolo Bonzini
2014-05-22 12:29 ` Stefan Hajnoczi
2014-06-03 13:34 ` Stefan Hajnoczi
4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2014-05-15 12:35 UTC (permalink / raw)
To: Fam Zheng, qemu-devel; +Cc: Stefan Hajnoczi
Il 15/05/2014 13:22, Fam Zheng ha scritto:
> This applies on top of Stefan's dataplane series.
>
> v2:
>
> Patch 1 moves the declaration of bdrv_get_aio_context to block.h.
> Patch 2 is unchanged except for the dropped #include.
>
>
> Fam Zheng (2):
> block: Move declaration of bdrv_get_aio_context to block.h
> virtio-blk: Allow config-wce in dataplane
>
> hw/block/dataplane/virtio-blk.c | 6 ------
> hw/block/virtio-blk.c | 8 +++++++-
> include/block/block.h | 7 +++++++
> include/block/block_int.h | 7 -------
> 4 files changed, 14 insertions(+), 14 deletions(-)
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] dataplane: Enable config-wce
2014-05-15 11:22 [Qemu-devel] [PATCH v2 0/2] dataplane: Enable config-wce Fam Zheng
` (2 preceding siblings ...)
2014-05-15 12:35 ` [Qemu-devel] [PATCH v2 0/2] dataplane: Enable config-wce Paolo Bonzini
@ 2014-05-22 12:29 ` Stefan Hajnoczi
2014-06-03 13:34 ` Stefan Hajnoczi
4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-05-22 12:29 UTC (permalink / raw)
To: Fam Zheng; +Cc: Paolo Bonzini, qemu-devel
On Thu, May 15, 2014 at 07:22:04PM +0800, Fam Zheng wrote:
> This applies on top of Stefan's dataplane series.
>
> v2:
>
> Patch 1 moves the declaration of bdrv_get_aio_context to block.h.
> Patch 2 is unchanged except for the dropped #include.
>
>
> Fam Zheng (2):
> block: Move declaration of bdrv_get_aio_context to block.h
> virtio-blk: Allow config-wce in dataplane
>
> hw/block/dataplane/virtio-blk.c | 6 ------
> hw/block/virtio-blk.c | 8 +++++++-
> include/block/block.h | 7 +++++++
> include/block/block_int.h | 7 -------
> 4 files changed, 14 insertions(+), 14 deletions(-)
>
> --
> 1.9.2
>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] dataplane: Enable config-wce
2014-05-15 11:22 [Qemu-devel] [PATCH v2 0/2] dataplane: Enable config-wce Fam Zheng
` (3 preceding siblings ...)
2014-05-22 12:29 ` Stefan Hajnoczi
@ 2014-06-03 13:34 ` Stefan Hajnoczi
4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-06-03 13:34 UTC (permalink / raw)
To: Fam Zheng; +Cc: Paolo Bonzini, qemu-devel, Stefan Hajnoczi
On Thu, May 15, 2014 at 07:22:04PM +0800, Fam Zheng wrote:
> This applies on top of Stefan's dataplane series.
>
> v2:
>
> Patch 1 moves the declaration of bdrv_get_aio_context to block.h.
> Patch 2 is unchanged except for the dropped #include.
>
>
> Fam Zheng (2):
> block: Move declaration of bdrv_get_aio_context to block.h
> virtio-blk: Allow config-wce in dataplane
>
> hw/block/dataplane/virtio-blk.c | 6 ------
> hw/block/virtio-blk.c | 8 +++++++-
> include/block/block.h | 7 +++++++
> include/block/block_int.h | 7 -------
> 4 files changed, 14 insertions(+), 14 deletions(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread