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