[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/42] virtio-blk: Allow config-wce in dataplane
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 28/42] virtio-blk: Allow config-wce in dataplane |
Date: |
Fri, 6 Jun 2014 18:13:49 +0200 |
From: Fam Zheng <address@hidden>
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 <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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 c058c73..217992b 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -336,12 +336,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.3
- [Qemu-devel] [PULL 16/42] block/linux-aio: fix memory and fd leak, (continued)
- [Qemu-devel] [PULL 16/42] block/linux-aio: fix memory and fd leak, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 17/42] block/raw-win32: create one QEMUWin32AIOState per BDRVRawState, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 19/42] rbd: use BlockDriverState's AioContext, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 18/42] block/raw-win32: implement .bdrv_detach/attach_aio_context(), Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 24/42] dataplane: delete IOQueue since it is no longer used, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 25/42] dataplane: implement async flush, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 20/42] sheepdog: implement .bdrv_detach/attach_aio_context(), Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 26/42] raw-posix: drop raw_get_aio_fd() since it is no longer used, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 27/42] block: Move declaration of bdrv_get_aio_context to block.h, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 22/42] vmdk: implement .bdrv_detach/attach_aio_context(), Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 28/42] virtio-blk: Allow config-wce in dataplane,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 29/42] virtio-blk: Factor out virtio_blk_handle_scsi_req from virtio_blk_handle_scsi, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 31/42] throttle: add throttle_detach/attach_aio_context(), Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 30/42] dataplane: Support VIRTIO_BLK_T_SCSI_CMD, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 32/42] throttle: add detach/attach test case, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 33/42] blockdev: acquire AioContext in block_set_io_throttle, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 34/42] block: fix wrong order in live block migration setup, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 36/42] rbd: Fix leaks in rbd_start_aio() error path, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 35/42] qemu-img: Document check exit codes, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 40/42] qapi: create two block related json modules, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 39/42] qapi: Extract qapi/common.json definitions, Stefan Hajnoczi, 2014/06/06