| 55 | |
| 56 | impl QcowAsync { |
| 57 | pub(crate) fn new( |
| 58 | metadata: Arc<QcowMetadata>, |
| 59 | data_file: QcowRawFile, |
| 60 | backing_file: Option<Arc<dyn BackingRead>>, |
| 61 | sparse: bool, |
| 62 | ring_depth: u32, |
| 63 | ) -> io::Result<Self> { |
| 64 | let alignment = data_file.file().alignment(); |
| 65 | let io_alignment = max(alignment as u64, SECTOR_SIZE); |
| 66 | let io_uring = IoUring::new(ring_depth)?; |
| 67 | let eventfd = EventFd::new(libc::EFD_NONBLOCK)?; |
| 68 | io_uring.submitter().register_eventfd(eventfd.as_raw_fd())?; |
| 69 | |
| 70 | Ok(QcowAsync { |
| 71 | cluster_size: metadata.cluster_size(), |
| 72 | decoder: metadata.decoder(), |
| 73 | metadata, |
| 74 | data_file, |
| 75 | backing_file, |
| 76 | sparse, |
| 77 | alignment, |
| 78 | io_alignment, |
| 79 | io_uring, |
| 80 | eventfd, |
| 81 | completion_list: VecDeque::new(), |
| 82 | }) |
| 83 | } |
| 84 | |
| 85 | fn apply_dealloc_action(&mut self, action: &DeallocAction) { |
| 86 | match action { |