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

Method update_writeback

vhost_user_block/src/lib.rs:280–300  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

278 }
279
280 fn update_writeback(&mut self) {
281 // Use writeback from config if VIRTIO_BLK_F_CONFIG_WCE
282 let writeback = if self.acked_features & (1 << VIRTIO_BLK_F_CONFIG_WCE)
283 == 1 << VIRTIO_BLK_F_CONFIG_WCE
284 {
285 self.config.writeback == 1
286 } else {
287 // Else check if VIRTIO_BLK_F_FLUSH negotiated
288 self.acked_features & (1 << VIRTIO_BLK_F_FLUSH) == 1 << VIRTIO_BLK_F_FLUSH
289 };
290
291 info!(
292 "Changing cache mode to {}",
293 if writeback {
294 "writeback"
295 } else {
296 "writethrough"
297 }
298 );
299 self.writeback.store(writeback, Ordering::Release);
300 }
301}
302
303impl VhostUserBackendMut for VhostUserBlkBackend {

Callers 2

acked_featuresMethod · 0.80
set_configMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected