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

Method flush_blocks

block/src/qcow/refcount.rs:170–182  ·  view source on GitHub ↗

Flush the dirty refcount blocks. This must be done before flushing the table that points to the blocks.

(&mut self, raw_file: &mut QcowRawFile)

Source from the content-addressed store, hash-verified

168 /// Flush the dirty refcount blocks. This must be done before flushing the table that points to
169 /// the blocks.
170 pub fn flush_blocks(&mut self, raw_file: &mut QcowRawFile) -> io::Result<()> {
171 // Write out all dirty L2 tables.
172 for (table_index, block) in self.refblock_cache.iter_mut().filter(|(_k, v)| v.dirty()) {
173 let addr = self.ref_table[*table_index];
174 if addr != 0 {
175 raw_file.write_refcount_block(addr, block.get_values())?;
176 } else {
177 return Err(std::io::Error::from_raw_os_error(EINVAL));
178 }
179 block.mark_clean();
180 }
181 Ok(())
182 }
183
184 /// Flush the refcount table that keeps the address of the refcounts blocks.
185 /// Returns true if the table changed since the previous `flush_table()` call.

Callers 2

sync_cachesMethod · 0.80
sync_cachesMethod · 0.80

Calls 5

iter_mutMethod · 0.80
dirtyMethod · 0.80
write_refcount_blockMethod · 0.80
get_valuesMethod · 0.80
mark_cleanMethod · 0.80

Tested by

no test coverage detected