dataplane: Enable config-wce
v2 cover dataplane: Enable config-wce
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(-)
Signature · 1 line
1.9.2
PATCH v2 1/2 block: Move declaration of bdrv_get_aio_context to block.h
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.
--- include/block/block.h | 7 +++++++ include/block/block_int.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
include/block/block.h +7 -0
@@ -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
include/block/block_int.h +0 -7
@@ -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
Signature · 1 line
1.9.2
PATCH v2 2/2 virtio-blk: Allow config-wce in dataplane
In reply to Fam ZhengDataplane 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.
--- hw/block/dataplane/virtio-blk.c | 6 ------ hw/block/virtio-blk.c | 8 +++++++- 2 files changed, 7 insertions(+), 7 deletions(-)
hw/block/dataplane/virtio-blk.c +0 -6
@@ -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. */
hw/block/virtio-blk.c +7 -1
@@ -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)); } }
Signature · 1 line
1.9.2
Il 15/05/2014 13:22, Fam Zheng ha scritto:
Quoted 12 lines
This applies on top of Stefan's dataplane series.
v2:
Patch 1 moves the declaration of
bdrv_get_aio_contexttoblock.h. Patch 2 is unchanged except for the dropped #include.Fam Zheng (2):
block: Move declaration ofbdrv_get_aio_contexttoblock.h
virtio-blk: Allow config-wce in dataplane
Quoted 6 lines
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(-)
Quoted 12 lines · Fam Zheng
This applies on top of Stefan's dataplane series.
v2:
Patch 1 moves the declaration of
bdrv_get_aio_contexttoblock.h. Patch 2 is unchanged except for the dropped #include.Fam Zheng (2):
block: Move declaration ofbdrv_get_aio_contexttoblock.h
virtio-blk: Allow config-wce in dataplane
Quoted 9 lines
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(-)Signature · 1 line
1.9.2
Stefan Hajnoczi
AppliedQuoted 12 lines · Fam Zheng
This applies on top of Stefan's dataplane series.
v2:
Patch 1 moves the declaration of
bdrv_get_aio_contexttoblock.h. Patch 2 is unchanged except for the dropped #include.Fam Zheng (2):
block: Move declaration ofbdrv_get_aio_contexttoblock.h
virtio-blk: Allow config-wce in dataplane
Quoted 5 lines
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