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

Method write_vectored

block/src/qcow_async.rs:161–182  ·  view source on GitHub ↗

TODO Make writes async. Writes are synchronous. Async writes require a multi step state machine for COW (backing read, cluster allocation, data write, L2 commit) with per request buffer lifetime tracking and write ordering.

(
        &mut self,
        offset: libc::off_t,
        iovecs: &[libc::iovec],
        user_data: u64,
    )

Source from the content-addressed store, hash-verified

159 // write, L2 commit) with per request buffer lifetime tracking
160 // and write ordering.
161 fn write_vectored(
162 &mut self,
163 offset: libc::off_t,
164 iovecs: &[libc::iovec],
165 user_data: u64,
166 ) -> AsyncIoResult<()> {
167 Self::cow_write_sync(
168 offset as u64,
169 iovecs,
170 &self.metadata,
171 &self.data_file,
172 &self.backing_file,
173 self.alignment,
174 self.cluster_size,
175 )?;
176
177 let total_len: usize = iovecs.iter().map(|v| v.iov_len).sum();
178 self.completion_list
179 .push_back((user_data, total_len as i32));
180 self.eventfd.write(1).unwrap();
181 Ok(())
182 }
183
184 fn fsync(&mut self, user_data: Option<u64>) -> AsyncIoResult<()> {
185 self.metadata.flush().map_err(AsyncIoError::Fsync)?;

Callers 1

async_writeFunction · 0.45

Calls 3

iterMethod · 0.80
mapMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected