diff --git a/Cargo.lock b/Cargo.lock index 6ceceef66..ee55bbd43 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -463,9 +463,9 @@ dependencies = [ [[package]] name = "io-uring" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7589adca0ddd74f56ed83a5098b45e3abf264dc27e150a8bec3397fcc34338" +checksum = "4e06a309d419b77e3036c1eb5683482c9ee51cff165e448d04bd601b6cd16360" dependencies = [ "bitflags 1.2.1", "libc", diff --git a/block_util/src/raw_async.rs b/block_util/src/raw_async.rs index 6c585d03c..5fdd8f152 100644 --- a/block_util/src/raw_async.rs +++ b/block_util/src/raw_async.rs @@ -5,7 +5,7 @@ use crate::async_io::{ AsyncIo, AsyncIoError, AsyncIoResult, DiskFile, DiskFileError, DiskFileResult, }; -use io_uring::{opcode, squeue, IoUring}; +use io_uring::{opcode, squeue, types, IoUring}; use std::fs::File; use std::io::{Seek, SeekFrom}; use std::os::unix::io::{AsRawFd, RawFd}; @@ -71,28 +71,23 @@ impl AsyncIo for RawFileAsync { iovecs: Vec, user_data: u64, ) -> AsyncIoResult<()> { - let (submitter, sq, _) = self.io_uring.split(); - let mut avail_sq = sq.available(); + let (submitter, mut sq, _) = self.io_uring.split(); // Safe because we know the file descriptor is valid and we // relied on vm-memory to provide the buffer address. let _ = unsafe { - avail_sq.push( - opcode::Readv::new( - opcode::types::Fd(self.fd), - iovecs.as_ptr(), - iovecs.len() as u32, - ) - .offset(offset) - .build() - .flags(squeue::Flags::ASYNC) - .user_data(user_data), + sq.push( + &opcode::Readv::new(types::Fd(self.fd), iovecs.as_ptr(), iovecs.len() as u32) + .offset(offset) + .build() + .flags(squeue::Flags::ASYNC) + .user_data(user_data), ) }; // Update the submission queue and submit new operations to the // io_uring instance. - avail_sq.sync(); + sq.sync(); submitter.submit().map_err(AsyncIoError::ReadVectored)?; Ok(()) @@ -104,28 +99,23 @@ impl AsyncIo for RawFileAsync { iovecs: Vec, user_data: u64, ) -> AsyncIoResult<()> { - let (submitter, sq, _) = self.io_uring.split(); - let mut avail_sq = sq.available(); + let (submitter, mut sq, _) = self.io_uring.split(); // Safe because we know the file descriptor is valid and we // relied on vm-memory to provide the buffer address. let _ = unsafe { - avail_sq.push( - opcode::Writev::new( - opcode::types::Fd(self.fd), - iovecs.as_ptr(), - iovecs.len() as u32, - ) - .offset(offset) - .build() - .flags(squeue::Flags::ASYNC) - .user_data(user_data), + sq.push( + &opcode::Writev::new(types::Fd(self.fd), iovecs.as_ptr(), iovecs.len() as u32) + .offset(offset) + .build() + .flags(squeue::Flags::ASYNC) + .user_data(user_data), ) }; // Update the submission queue and submit new operations to the // io_uring instance. - avail_sq.sync(); + sq.sync(); submitter.submit().map_err(AsyncIoError::WriteVectored)?; Ok(()) @@ -133,13 +123,12 @@ impl AsyncIo for RawFileAsync { fn fsync(&mut self, user_data: Option) -> AsyncIoResult<()> { if let Some(user_data) = user_data { - let (submitter, sq, _) = self.io_uring.split(); - let mut avail_sq = sq.available(); + let (submitter, mut sq, _) = self.io_uring.split(); // Safe because we know the file descriptor is valid. let _ = unsafe { - avail_sq.push( - opcode::Fsync::new(opcode::types::Fd(self.fd)) + sq.push( + &opcode::Fsync::new(types::Fd(self.fd)) .build() .flags(squeue::Flags::ASYNC) .user_data(user_data), @@ -148,7 +137,7 @@ impl AsyncIo for RawFileAsync { // Update the submission queue and submit new operations to the // io_uring instance. - avail_sq.sync(); + sq.sync(); submitter.submit().map_err(AsyncIoError::Fsync)?; } else { unsafe { libc::fsync(self.fd) }; @@ -161,7 +150,7 @@ impl AsyncIo for RawFileAsync { let mut completion_list = Vec::new(); let cq = self.io_uring.completion(); - for cq_entry in cq.available() { + for cq_entry in cq { completion_list.push((cq_entry.user_data(), cq_entry.result())); } diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index e3f9408be..70d4f7b2d 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -273,9 +273,9 @@ dependencies = [ [[package]] name = "io-uring" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7589adca0ddd74f56ed83a5098b45e3abf264dc27e150a8bec3397fcc34338" +checksum = "4e06a309d419b77e3036c1eb5683482c9ee51cff165e448d04bd601b6cd16360" dependencies = [ "bitflags", "libc", @@ -512,9 +512,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43535db9747a4ba938c0ce0a98cc631a46ebf943c9e1d604e091df6007620bf6" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ "itoa", "ryu",