MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / is_writeback_enabled

Method is_writeback_enabled

virtio-devices/src/block.rs:995–999  ·  view source on GitHub ↗

The virtio v1.2 spec says "If VIRTIO_BLK_F_CONFIG_WCE was not negotiated but VIRTIO_BLK_F_FLUSH was, the driver SHOULD assume presence of a writeback cache." It also says "If VIRTIO_BLK_F_CONFIG_WCE is negotiated but VIRTIO_BLK_F_FLUSH is not, the device MUST initialize writeback to 0."

(&self, desired: bool)

Source from the content-addressed store, hash-verified

993 /// VIRTIO_BLK_F_CONFIG_WCE is negotiated but VIRTIO_BLK_F_FLUSH is not,
994 /// the device MUST initialize writeback to 0."
995 fn is_writeback_enabled(&self, desired: bool) -> bool {
996 let flush = self.common.feature_acked(VIRTIO_BLK_F_FLUSH.into());
997 let wce = self.common.feature_acked(VIRTIO_BLK_F_CONFIG_WCE.into());
998 if wce { flush && desired } else { flush }
999 }
1000
1001 fn set_writeback_mode(&mut self, enabled: bool) {
1002 self.config.writeback = enabled as u8;

Callers 2

write_configMethod · 0.80
activateMethod · 0.80

Calls 1

feature_ackedMethod · 0.80

Tested by

no test coverage detected