Flush the dirty refcount blocks. This must be done before flushing the table that points to the blocks.
(&mut self, raw_file: &mut QcowRawFile)
| 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. |
no test coverage detected