Skip to content

Commit 1dd5683

Browse files
authored
Merge pull request #273 from Sherlock-Holo/better-io-uring-cqe-more
refactor(driver): better IORING_CQE_F_MORE handle
2 parents d75b76e + b0de9f1 commit 1dd5683

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

compio-driver/src/iour/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ cfg_if::cfg_if! {
2020
}
2121
}
2222
use io_uring::{
23+
cqueue::more,
2324
opcode::{AsyncCancel, PollAdd},
2425
types::{Fd, SubmitArgs, Timespec},
2526
IoUring,
@@ -152,9 +153,8 @@ impl Driver {
152153
let completed_entries = cqueue.filter_map(|entry| match entry.user_data() {
153154
Self::CANCEL => None,
154155
Self::NOTIFY => {
155-
const IORING_CQE_F_MORE: u32 = 1 << 1;
156156
let flags = entry.flags();
157-
debug_assert!(flags & IORING_CQE_F_MORE == IORING_CQE_F_MORE);
157+
debug_assert!(more(flags));
158158
self.notifier.clear().expect("cannot clear notifier");
159159
None
160160
}

compio-io/src/compat.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ impl<S> SyncStream<S> {
6767
impl<S> Read for SyncStream<S> {
6868
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
6969
let mut slice = self.fill_buf()?;
70-
slice.read(buf).map(|res| {
71-
self.consume(res);
72-
res
70+
slice.read(buf).inspect(|res| {
71+
self.consume(*res);
7372
})
7473
}
7574

compio/tests/runtime.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ async fn drop_on_complete() {
127127
}
128128

129129
#[compio_macros::test]
130+
#[cfg_attr(
131+
not(any(windows, all(target_os = "linux", feature = "io-uring"))),
132+
ignore
133+
)]
130134
async fn too_many_submissions() {
131135
let tempfile = tempfile();
132136

0 commit comments

Comments
 (0)