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)
| 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; |
no test coverage detected