mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-23 08:21:15 +00:00
vhost_user_blk: Add missing WCE property support
Add missing WCE (write-cache enable) property support. This not only an enhancement, but also a fix for a bug. Right now, when vhost_user_blk uses a qcow2 image, it doesn't write the QCOW2 metadata until the guest explicitly requests a flush. In practice, this is equivalent to the write back semantic. Without WCE, the guest assumes write through for the virtio_blk device, and doesn't send those flush requests. Adding support for WCE, and enabling it by default, we ensure the guest does send said requests. Supporting "WCE = false" would require updating our qcow2 implementation to ensure that, when required, it honors the write through semantics by not deferring the updates to QCOW2 metadata. Signed-off-by: Sergio Lopez <slp@redhat.com>
This commit is contained in:
parent
c7e9056c1e
commit
e0a8da2f46
@ -107,6 +107,7 @@ impl VhostUserBlkBackend {
|
|||||||
config.min_io_size = 1;
|
config.min_io_size = 1;
|
||||||
config.opt_io_size = 1;
|
config.opt_io_size = 1;
|
||||||
config.num_queues = 1;
|
config.num_queues = 1;
|
||||||
|
config.wce = 1;
|
||||||
|
|
||||||
Ok(VhostUserBlkBackend {
|
Ok(VhostUserBlkBackend {
|
||||||
mem: None,
|
mem: None,
|
||||||
@ -173,6 +174,7 @@ impl VhostUserBackend for VhostUserBlkBackend {
|
|||||||
|
|
||||||
fn features(&self) -> u64 {
|
fn features(&self) -> u64 {
|
||||||
let mut avail_features = 1 << VIRTIO_BLK_F_MQ
|
let mut avail_features = 1 << VIRTIO_BLK_F_MQ
|
||||||
|
| 1 << VIRTIO_BLK_F_CONFIG_WCE
|
||||||
| 1 << VIRTIO_F_VERSION_1
|
| 1 << VIRTIO_F_VERSION_1
|
||||||
| VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
|
| VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user